Description
You can call this operation to query details about database users.
Call description
Prerequisites
You have passed the authentication for the OCP application service.
You have the Read permission on the specified tenant.
Request path
GET /api/v2/ob/clusters/{id}/tenants/{tenantId}/users/{username}
Request parameters
path parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| id | Integer | Yes | 1 | The ID of the cluster. |
| tenantId | Integer | Yes | 5 | The ID of the tenant. |
| username | String | Yes | root | The username. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| data | Object | The database user. For more information about the data structure, see the following table. |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | An HTTP status code. |
| traceId | String | The trace ID of the request. This trace ID is used for troubleshooting. |
| server | String | The address of the application server that responded to the request. |
Data structure of database user information
| Parameter | Type | Description |
|---|---|---|
| username | String | The username. |
| globalPrivileges | StringArray | The list of global privileges. * For MySQL tenants, it is a list of global privileges. * For Oracle tenants, it is a list of system privileges. |
| dbPrivileges | Array | The list of database privileges.
|
| ├─ dbName | String | The name of the database. |
| ├─ privileges | StringArray | The list of database privileges. |
| objectPrivileges | Array | The list of object privileges.
|
| ├─ dbObject | Object | The database object. |
| ├─ privileges | StringArray | The list of object privileges. |
| grantedRoles | String | The roles granted to the user.
|
| isLocked | Bool | Indicates whether the user has been locked. |
| createTime | Datetime | The time when the user account was created. |
| connectionStrings | Array | The list of OBProxies and connection strings. |
| ├─ connectionStringType | String | The type of the connection string. Valid values: * OBPROXY * DIRECT |
| ├─ obProxyAddress | String | The IP address of the OBProxy.
|
| ├─ obProxyPort | Integer | The port number of the OBProxy.
|
| ├─ connectionString | String | The connection string. |
| accessibleDatabases | StringArray | The accessible database.
|
dbObject parameters
| Parameter | Type | Description |
|---|---|---|
| objectType | String | The type of the database object. Valid values: * TABLE * VIEW * STORED_PROCEDURE |
| objectName | String | The name of the database object, namely, the name of the table, view, or stored procedure. |
| schemaName | String | The schema name, which is generally the same as the username. |
Examples
Sample request
Query the details of the root user in Tenant 1000001 of Cluster 1.
GET /api/v2/ob/clusters/1/tenants/1000001/users/root?id=1&tenantId=1000001&username=root
Sample response
{
"data": {
"accessibleDatabases": [
"oceanbase",
"information_schema",
"mysql",
"test",
"db1"
],
"connectionStrings": [
{
"connectionString": "mysql -hxx.xx.xx.xx -P2881 -uroot@mysql1 -p",
"type": "DIRECT"
}
],
"createTime": "2021-09-06T11:38:44.585445+08:00",
"dbPrivileges": [
{
"dbName": "mysql",
"privileges": [
"SELECT",
"INSERT",
"UPDATE",
"DELETE",
"CREATE",
"DROP",
"INDEX",
"ALTER",
"CREATE_VIEW",
"SHOW_VIEW"
]
},
{
"dbName": "oceanbase",
"privileges": [
"SELECT",
"INSERT",
"UPDATE",
"DELETE",
"CREATE",
"DROP",
"INDEX",
"ALTER",
"CREATE_VIEW",
"SHOW_VIEW"
]
},
{
"dbName": "test",
"privileges": [
"SELECT",
"INSERT",
"UPDATE",
"DELETE",
"CREATE",
"DROP",
"INDEX",
"ALTER",
"CREATE_VIEW",
"SHOW_VIEW"
]
},
{
"dbName": "information_schema",
"privileges": [
"SELECT",
"INSERT",
"UPDATE",
"DELETE",
"CREATE",
"DROP",
"INDEX",
"ALTER",
"CREATE_VIEW",
"SHOW_VIEW"
]
}
],
"globalPrivileges": [
"ALTER",
"CREATE",
"DELETE",
"DROP",
"GRANT_OPTION",
"INSERT",
"UPDATE",
"SELECT",
"INDEX",
"CREATE_VIEW",
"SHOW_VIEW",
"SHOW_DATABASES",
"CREATE_USER",
"SUPER",
"PROCESS"
],
"isLocked": false,
"username": "root".
},
"duration": 429,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-09-07T15:12:20.703+08:00",
"traceId": "28857c5276f24a35"
}