Applicability
Modifying user roles in a standby instance is not supported in the current version.
Overview
You can call this API to modify the role of a specified user under 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
| Parameter | Type | Required | Description | Example Value |
|---|---|---|---|---|
| instanceId | string | Yes | The ID of the OceanBase 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
| Parameter | Type | Required | Description | Example Value |
|---|---|---|---|---|
| modifyType | string | Yes | The modification type. | UPDATE |
| database | string | Yes | The name of the database. | testdb |
| role | string | Yes | The role type. Valid values:
|
DML |
Response parameters
| Parameter | Type | Description | Example Value |
|---|---|---|---|
| data | The result of the request. | ||
| datalist | The 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 transmitted.
|
0 |
| requestId | string | The ID of the request. | 71f8acbe-xxxx-xxxx-xxxx-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
}