-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAT-13486]Provide admin user with replication role privileges to cr…
…eate replication slots Summary: Use case: To enhance `createRestrictedUser` in YBA to accept a list of `DbRoleAttributes` and apply using an `ALTER ROLE <restricted_user> WITH <roleAttribute>` statement when creating the user. This diff adds a payload parameter `dbRoleAttributes`, which accepts a list of `RoleAttribute` objects and the user is granted these roles during both the APIs: `create_restricted_db_credentials` & `create_db_credentials` The supported roleAttributes for YSQL are: `SUPERUSER`, `NOSUPERUSER`, `CREATEDB`, `NOCREATEDB`, `CREATEROLE`, `NOCREATEROLE`, `INHERIT`, `NOINHERIT`, `LOGIN`, `NOLOGIN`, `REPLICATION`, `NOREPLICATION`, `BYPASSRLS`, `NOBYPASSRLS` ref: https://www.postgresql.org/docs/current/sql-createrole.html Test Plan: Manual Testing Endpoint: ``` POST /customers/:cUUID/universes/:uniUUID/create_restricted_db_credentials ``` and ``` POST /customers/:cUUID/universes/:uniUUID/create_db_credentials ``` - Payload: ``` { "ycqlAdminUsername": "", "ycqlAdminPassword": "", "ysqlAdminUsername": "yugabyte", "ysqlAdminPassword": "", "dbName": "", "username": "test", "password": "Test@123", "dbRoleAttributes": [] } ``` User `test` is created but no permissions are granted for the same. - Payload: ``` { "ycqlAdminUsername": "", "ycqlAdminPassword": "", "ysqlAdminUsername": "yugabyte", "ysqlAdminPassword": "", "dbName": "", "username": "test", "password": "Test@123", "dbRoleAttributes": [ {"name": "REPLICATION"}, {"name": "CREATEROLE"} ] } ``` User `test` is granted `REPLICATION` & `CREATEROLE` permissions - Payload: ``` { "ycqlAdminUsername": "", "ycqlAdminPassword": "", "ysqlAdminUsername": "yugabyte", "ysqlAdminPassword": "", "dbName": "", "username": "test", "password": "Test@123", "dbRoleAttributes": [ {"name": "REPLICATION"}, {"name": "test"} ] } ``` response: ``` { "success": false, "error": { "dbRoleAttributes[1].name": [ "Invalid value" ] } } ``` Reviewers: #yba-api-review, sneelakantan, svarshney Reviewed By: #yba-api-review, sneelakantan Subscribers: yugaware Differential Revision: https://phorge.dev.yugabyte.com/D34523
- Loading branch information
rohita
committed
May 6, 2024
1 parent
0af5906
commit 749d700
Showing
5 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters