Help Center> Data Lake Insight> API Reference> Permission-related APIs> Viewing the Granted Permissions of a User
Updated on 2024-03-15 GMT+08:00

Viewing the Granted Permissions of a User

Function

This API is used to view the permissions granted to a user.

URI

  • URI format

    GET /v1.0/{project_id}/authorization/privileges

  • Parameter descriptions:
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.

Table 2 query parameter description

Parameter

Mandatory

Type

Description

object

Yes

String

Data object to be assigned, which corresponds to the object in API permission assignment.

  • jobs.flink.Fink job ID, data in the specified job will be queried.
  • groups. Package group name, data in the specified package group will be queried.
  • resources.Package name, data in the specified package will be queried.
    NOTE:

    When you view the packages in a group, the object format is resources.package group name/package name.

offset

No

Integer

Specifies the offset of the page-based query.

limit

No

Integer

Number of records to be displayed of the page-based query.

The following is an example of the URL containing the query parameter:

GET /v1.0/{project_id}/authorization/privileges?object={object}

Request

None

Response

Table 3 Response parameters

Parameter

Mandatory

Type

Description

is_success

Yes

Boolean

Whether the request is successfully executed. Value true indicates that the request is successfully executed.

message

Yes

String

Indicates the system prompt. If execution succeeds, this parameter may be left blank.

object_name

No

String

Object name.

object_type

No

String

Object type.

privileges

No

Array of Object

Permission information. For details, see Table 4.

count

No

Integer

Total number of permissions.

Table 4 privileges parameters

Parameter

Mandatory

Type

Description

object

No

String

Data object whose permissions are to be granted, which corresponds to the object in the permission assignment API.

is_admin

No

Boolean

Whether the database user is an administrator.

user_name

No

String

Name of the user who has permission on the current database.

privileges

No

Array of Strings

Permission of the user on the database.

Example Request

None

Example Response

{
    "is_success": true,
    "message": "",
    "object_name": "9561",
    "object_type": "flink",
    "count": 2,
    "privileges": [
        {
            "user_name": "testuser1",
            "is_admin": true,
            "privileges": [
                "ALL"
            ]
        },
        {
            "user_name": "user1",
            "is_admin": false,
            "privileges": [
                "GET"
            ]
        }
    ]
}

Status Codes

Table 5 describes the status code.

Table 5 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.

Table 6 Error codes

Error Code

Error Message

DLI.0001

user input validation failed, object_type sql or saprk is not supported now