Applicability
Currently, this API does not support modifying user permissions for standby clusters.
Overview
You can call this API to modify the roles of a specified user in a tenant.
API details
Constraints
The caller must have an AccessKey for accessing APIs of OceanBase Cloud. For information about how to obtain the AccessKey ID and AccessKey secret, see Manage AccessKeys.
Request path
POST /api/v2/instances/{instanceId}/tenants/{tenantId}/tenantUsers/{userName}/authorization
Request parameters
Query
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| instanceId | string | Yes | The ID of the OceanBase Cloud instance. | ob317v4uif**** |
| tenantId | string | Yes | The ID of the tenant. | t4pnum**** |
| userName | string | Yes | The name of the database account. Reserved keywords such as SYS and root cannot be used. | test |
Body
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| modifyType | string | Yes | The type of modification. | UPDATE |
| database | string | Yes | The name of the database. | testdb |
| role | string | Yes | The type of role. Valid values:
|
DML |
Response parameters
| Name | Type | Description | Example value |
|---|---|---|---|
| data | The return result of the request. | ||
| datalist | The return result of the request. | ||
| database | string | The name of the database. | mysql |
| privileges | string | The privilege information. | SELECT |
| table | string | The name of the table. | test_1 |
| userName | string | The name of the user. | normal |
| privilegeType | string | The type of authorization. | DEFAULT |
| withGrant | boolean | Whether the privilege can be granted.
|
0 |
| requestId | string | The ID of the request. | 71f8acbe-e009-4a88-b417-8cbaf1b8ac3d |
| success | boolean | The execution status of the request. | true |
Examples
Request example
curl -X --request POST \
--digest -u 'ak:sk' \
--url 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/tenantUsers/{userName}/authorization' \
-H 'X-Ob-Project-Id: <Project ID>'
--data \ '{"modifyType": "UPDATE", "userRole": [ {"database": "testdb", "role": "DML"} ] }'
Note
- A project ID uniquely identifies a project. For information about how to obtain the project ID of an instance, see Manage projects.
- Make sure that the project ID corresponding to the specified instanceId is consistent with the specified project ID.
Response example
JSON format
{
"data":{
"databases":[
{
"database":"mysql",
"privileges":"SELECT",
"table":"*",
"userName":"normal",
"privilegeType":"DEFAULT",
"withGrant":0
},
{
"database":"oceanbase",
"privileges":"SELECT",
"table":"*",
"userName":"normal",
"privilegeType":"DEFAULT",
"withGrant":0
},
{
"database":"testdb",
"Privileges":"SELECT,INSERT,UPDATE,DELETE,SHOW VIEW",
"role":"DML",
"table":"*",
"userName":"normal",
"privilegeType":"DEFAULT",
"withGrant":0
}
],
"userName":"normal"
},
"success":true
}
