Queries the permissions of a specific user on a database or a table.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListUserPermissions

The operation that you want to perform. Set the value to ListUserPermissions.

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.
PermType String Yes DATABASE

The permissions on a specific type of resources that you want to query. Valid values:

  • DATABASE: permissions on databases
  • TABLE: permissions on tables
  • COLUMN: permissions on fields
  • INSTANCE: permissions on instances
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.
DatabaseName String No db_name

The name of the database.

SearchKey String No rm-bp144d5ky4l4r****

The keyword used in the query. For example, if you want to query permissions on an instance, you can specify the endpoint of the instance, such as rm-bp144d5ky4l4r.

Logic Boolean No false

Specifies whether the database is a logical database. Valid values:

  • true: The database is a logical database.
  • false: The database is a physical database.
EnvType String No dev

The type of the environment to which the database belongs. Valid values:

  • product: production environment
  • dev: development environment
  • pre: staging environment
  • test: test environment
  • sit: SIT environment
  • uat: user acceptance testing (UAT) environment
  • pet: stress testing environment
  • stag: STAG environment
DbType String No polardb

The type of the database. For more information about the valid values of this parameter, see DbType parameter.

PageNumber Integer No 1

The number of the page to return.

PageSize Integer No 5

The number of entries to return on each page.

RegionId String No cn-hangzhou

The ID of the region in which DMS is activated. For more information about the valid values of this parameter, 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
TotalCount Long 1

The total number of entries that meet the query conditions.

RequestId String C51420E3-144A-4A94-B473-8662FCF4AD10

The ID of the request.

ErrorCode String UnknownError

The error code.

ErrorMessage String UnknownError

The error message.

UserPermissions Array of UserPermission

The details of the permissions that the user has.

UserPermission
DbId String 1860****

The ID of the database.

TableName String test_table

The name of the table.

UserId String 51****

The ID of the user.

SchemaName String test_db

The name of the database.

Logic Boolean false

Indicates whether the database is a logical database. Valid values:

  • true: The database is a logical database.
  • false: The database is a physical database.
UserNickName String nick_name

The nickname of the user.

InstanceId String 174****

The ID of the instance.

PermDetails Array of PermDetail

The details of permissions.

PermDetail
OriginFrom String Granted by xxx

The user who grants the permissions.

PermType String QUERY

The type of the permissions. Valid values:

  • QUERY: the query permissions
  • EXPORT: the export permissions
  • CORRECT: the change permissions
ExpireDate String 2020-12-12 00:00:00

The time when the permissions expire.

CreateDate String 2019-12-12 00:00:00

The time when the permissions were granted.

UserAccessId String 758****

The ID of the authorization record.

ExtraData String xxx

This parameter is reserved.

EnvType String dev

The type of the environment to which the database belongs. Valid values:

  • product: production environment
  • dev: development environment
  • pre: staging environment
  • test: test environment
  • sit: SIT environment
  • uat: UAT environment
  • pet: stress testing environment
  • stag: STAG environment
ColumnName String column_name

The name of the field.

DbType String polardb

The type of the database. For more information about the valid values of this parameter, see DbType parameter.

DsType String DATABASE

The permissions on a specific type of objects that are granted to the user. Valid values:

  • DATABASE: permissions on physical databases
  • LOGIC_DATABASE: permissions on logical databases
  • TABLE: permissions on physical tables
  • LOGIC_TABLE: permissions on logical tables
TableId String 13434

The ID of the table.

SearchName String test_db@xxx:3306

The name that is used to search for the database.

Alias String instance_alias

The alias of the instance.

Host String rm-bp144d5ky4l4r****

The endpoint that is used to connect the database.

Port Long 3306

The port that is used to connect to the instance.

Success Boolean true

Indicates whether the request is successful. Valid values:

  • true: The request is successful.
  • false: The request fails.

Examples

Sample requests

http(s)://dms-enterprise.aliyuncs.com/?Action=ListUserPermissions
&PermType=DATABASE
&UserId=51****
&DatabaseName=db_name
&SearchKey=rm-bp144d5ky4l4r****
&Logic=false
&EnvType=dev
&DbType=MySQL
&PageNumber=1
&PageSize=5
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListUserPermissionsResponse>
    <TotalCount>1</TotalCount>
    <RequestId>C51420E3-144A-4A94-B473-8662FCF4AD10</RequestId>
    <ErrorCode>UnknownError</ErrorCode>
    <ErrorMessage>UnknownError</ErrorMessage>
    <UserPermissions>
        <DbId>1860****</DbId>
        <TableName>test_table</TableName>
        <UserId>51****</UserId>
        <SchemaName>test_db</SchemaName>
        <Logic>false</Logic>
        <UserNickName>nick_name</UserNickName>
        <InstanceId>174****</InstanceId>
        <PermDetails>
            <OriginFrom>Granted by xxx</OriginFrom>
            <PermType>QUERY</PermType>
            <ExpireDate>2020-12-12 00:00:00</ExpireDate>
            <CreateDate>2019-12-12 00:00:00</CreateDate>
            <UserAccessId>758****</UserAccessId>
            <ExtraData>xxx</ExtraData>
        </PermDetails>
        <EnvType>dev</EnvType>
        <ColumnName>column_name</ColumnName>
        <DbType>polardb</DbType>
        <DsType>DATABASE</DsType>
        <TableId>13434</TableId>
        <SearchName>test_db@xxx:3306</SearchName>
        <Alias>instance_alias</Alias>
        <Host>rm-bp144d5ky4l4r****</Host>
        <Port>3306</Port>
    </UserPermissions>
    <Success>true</Success>
</ListUserPermissionsResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "TotalCount" : 1,
  "RequestId" : "C51420E3-144A-4A94-B473-8662FCF4AD10",
  "ErrorCode" : "UnknownError",
  "ErrorMessage" : "UnknownError",
  "UserPermissions" : [ {
    "DbId" : "1860****",
    "TableName" : "test_table",
    "UserId" : "51****",
    "SchemaName" : "test_db",
    "Logic" : false,
    "UserNickName" : "nick_name",
    "InstanceId" : "174****",
    "PermDetails" : [ {
      "OriginFrom" : "Granted by xxx",
      "PermType" : "QUERY",
      "ExpireDate" : "2020-12-12 00:00:00",
      "CreateDate" : "2019-12-12 00:00:00",
      "UserAccessId" : "758****",
      "ExtraData" : "xxx"
    } ],
    "EnvType" : "dev",
    "ColumnName" : "column_name",
    "DbType" : "polardb",
    "DsType" : "DATABASE",
    "TableId" : "13434",
    "SearchName" : "test_db@xxx:3306",
    "Alias" : "instance_alias",
    "Host" : "rm-bp144d5ky4l4r****",
    "Port" : 3306
  } ],
  "Success" : true
}

Error codes

For a list of error codes, visit the API Error Center.