Commit Graph
2 Commits
Author SHA1 Message Date
William Wang fe2f9a7ee7 Merged PR 1639930: Add Extensible Support for Role Privileges in UsersInfo Command
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description
We've implemented several key improvements to DocumentDB's user management system, with a focus on enhancing the `usersInfo` command to support privilege information display.

### Feature Overview

- Added support for the `showPrivileges` flag in `usersInfo` command
- When enabled, user information responses now include detailed privilege documents
- Privileges are organized by resource and action, similar to MongoDB's privilege format

### Implementation Details

1. **Privilege Data Structures**
   - Created predefined privilege sets for each role type (readOnly, readWrite, clusterAdmin)
   - Designed efficient merging of privilege sets with hash-based deduplication
2. **GUC Configuration**
   - Added `EnableUsersInfoPrivileges` boolean GUC to control feature availability
3. **Command Flow**
   - Parse `showPrivileges` flag from incoming BSON documents
   - When flag is true and GUC is enabled, append privilege array to user documents
   - Privileges include resource targets (cluster/database/collection) and action lists
4. **Memory Optimization**
   - Implemented hash-based privilege merging to avoid duplicate entries
   - Proper memory management with PostgreSQL allocation functions

This functionality supports the `connectionStatus` command, which requires authenticated user privileges.

We will also support `dbowner` and `root` roles, which will come in a follow-up PR.

Related work items: #3852887
2025-06-05 10:31:32 +08:00
Deepak Pemmaraju cdb390d2eb Merged PR 1600780: DataPlane External Identity Provider User CRUD
### Does this PR have any customer impact?

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)

### Are you introducing any new config? If yes, do you have tests with and without them being set?

### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description

----
#### AI description  (iteration 1)
#### PR Classification
New feature

#### PR Summary
This pull request introduces CRUD operations for Entra users in the DataPlane.
- `authentication.c`: Added functions to create users with external identity providers, validate identity provider info, and check if the current user is an Entra admin.
- `users.h`: Added new header file defining user CRUD functions and related structures.
- `users.c`: Updated user creation logic to handle external identity providers and added parsing for custom data.
- `api_hooks.c`: Added hooks for creating users with external identity providers and checking user privileges.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-04-07 11:39:49 +08:00