Grants permissions on an instance, a database, or a table to a user.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | GrantUserPermission |
The operation that you want to perform. Set the value to GrantUserPermission. |
Tid | Long | Yes | 3*** |
The ID of the tenant. Note To view the ID of the tenant, move the pointer over the profile picture in the upper-right
corner of the Data Management (DMS) console. For more information, see the "View information
about the current tenant" section of the Manage DMS tenants topic.
|
UserId | String | Yes | 51**** |
The ID of the user. You can call the GetUser or ListUsers operation to query the ID of the user. Note The user ID is different from the ID of your Alibaba Cloud account.
|
DsType | String | Yes | DATABASE |
The permissions on a specific type of object that you want to grant to the user. Valid values:
|
InstanceId | Long | No | 174**** |
The ID of the instance. You must specify this parameter if you grant permissions on an instance to the user. You can call the ListInstances or GetInstance operation to query the ID of the instance. |
DbId | String | Yes | 1*** |
The ID of the database. You can call the ListDatabases operation to query the ID of a physical database and the ListLogicDatabases operation to query the ID of a logical database. Note The value of the DatabaseId parameter is that of the DbId parameter.
|
Logic | Boolean | No | false |
Specifies whether the database is a logical database. You must specify this parameter if you grant permissions on a database to the user. Valid values:
|
TableId | String | No | 132*** |
The ID of the table. You must specify this parameter if you grant permissions on a table to the user. You can call the ListTables operation to query the table ID. |
TableName | String | No | table_name |
The name of the table. You must specify this parameter if you grant permissions on a table to the user. |
PermTypes | String | Yes | QUERY |
The permission type. Separate multiple permission types with commas (,). Valid values:
|
ExpireDate | String | Yes | 2021-12-12 00:00:00 |
The time when the permissions expire. |
RegionId | String | No | cn-hangzhou |
The region in which DMS is activated. For more information, see RegionID parameter. Note Set this parameter to the ID of the region that is in proximity to your applications.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | A99CD576-1E18-4E86-931E-C3CCE56DC030 |
The ID of the request. |
ErrorCode | String | UnknownError |
The error code. |
ErrorMessage | String | UnknownError |
The error message. |
Success | Boolean | true |
Indicates whether the request was successful. Valid values:
|
Examples
Sample requests
http(s)://dms-enterprise.aliyuncs.com/?Action=GrantUserPermission
&UserId=12345
&DsType=DATABASE
&InstanceId=13124
&DbId=1234
&Logic=false
&TableId=1324245
&TableName=table_name
&PermTypes=QUERY
&ExpireDate=2019-12-12 00:00:00
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<GrantUserPermissionResponse>
<RequestId>A99CD576-1E18-4E86-931E-C3CCE56DC030</RequestId>
<Success>true</Success>
</GrantUserPermissionResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "A99CD576-1E18-4E86-931E-C3CCE56DC030",
"Success" : true
}
Error codes
For a list of error codes, visit the API Error Center.