Updated on 2023-12-07 GMT+08:00

Querying a User's Table Permissions (Discarded)

Function

This API is used to query the permission of a specified user on a table.

This API has been discarded and is not recommended.

URI

  • URI format

    GET /v1.0/{project_id}/databases/{database_name}/tables/{table_name}/users/{user_name}

  • Parameter description
    Table 1 URI parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.

    database_name

    Yes

    String

    Name of the database where the table to be queried resides.

    table_name

    Yes

    String

    Name of a table that is to be queried.

    user_name

    Yes

    String

    Name of the user whose permission is to be queried.

Request

None

Response

Table 2 Response parameters

Parameter

Mandatory

Type

Description

is_success

No

Boolean

Whether the request is successfully executed. Value true indicates that the request is successfully executed. Example value: true.

message

No

String

System prompt. If execution succeeds, the parameter setting may be left blank. Example value: left blank.

user_name

No

String

Name of the user whose permission is to be queried.

privileges

No

Array Of objects

Permission information. For details, see Table 3.

Table 3 privileges parameters

Parameter

Mandatory

Type

Description

object

No

String

Objects on which a user has permission.

  • If the object is in the format of databases.Database name.tables.Table name, the user has permission on the database.
  • If the object is in the format of databases.Database name.tables.Table namecolumns.Column name, the user has permission on the table.

    Example value: databases.dsstest.tables.obs_231.

privileges

No

Array of Strings

Permission of the user on a specified object. Example value: [DESCRIBE_TABLE].

For details about table permissions, see Permissions Management.

Example Request

None

Example Response

{
  "is_success": true,
  "message": "",
  "privileges": [
    {
      "object": "databases.dsstest.tables.obs_2312",
      "privileges": [
        "DESCRIBE_TABLE"
      ]
    },
    {
      "object": "databases.dsstest.tables.obs_2312.columns.id",
      "privileges": [
        "SELECT"
      ]
    }
  ],
  "user_name": "scuser1"
}

Status Codes

Table 4 describes the status code.

Table 4 Status codes

Status Code

Description

200

Authorization succeeds.

400

Request error.

500

Internal service error.

Error Codes

If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Codes.