All Products
Search
Document Center

Data Management:GrantUserPermission

更新時間:Oct 21, 2024

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

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

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