All Products
Search
Document Center

Data Management:GrantUserPermission

Last Updated:Apr 18, 2024

Grants permissions on an instance, a database, or a table to a user.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
dms:GrantUserPermissionRead
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TidlongYes

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.
3***
UserIdstringYes

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.
51****
DsTypestringYes

The permissions on a specific type of object that you want to grant to the user. Valid values:

  • INSTANCE: permissions on instances
  • DATABASE: permissions on physical databases
  • LOGIC_DATABASE: permissions on logical databases
  • TABLE: permissions on physical tables
  • LOGIC_TABLE: permissions on logical tables
DATABASE
InstanceIdlongNo

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.

174****
DbIdstringYes

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.
1***
LogicbooleanNo

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:

  • true: The database is a logical database.
  • false: The database is a physical database.
false
TableIdstringNo

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.

132***
TableNamestringNo

The name of the table. You must specify this parameter if you grant permissions on a table to the user.

table_name
PermTypesstringYes

The permission type. Separate multiple permission types with commas (,). Valid values:

  • QUERY: the query permissions
  • EXPORT: the export permissions
  • CORRECT: the change permissions
  • LOGIN: the logon permissions
  • PERF: the query permissions on the performance details of the instance
QUERY
ExpireDatestringYes

The time when the permissions expire.

2021-12-12 00:00:00

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

A99CD576-1E18-4E86-931E-C3CCE56DC030
ErrorCodestring

The error code.

UnknownError
ErrorMessagestring

The error message.

UnknownError
Successboolean

Indicates whether the request was successful. Valid values:

  • true: The request was successful.
  • false: The request failed.
true

Examples

Sample success responses

JSONformat

{
  "RequestId": "A99CD576-1E18-4E86-931E-C3CCE56DC030",
  "ErrorCode": "UnknownError",
  "ErrorMessage": "UnknownError",
  "Success": true
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history