Updated on 2025-09-19 GMT+08:00

Querying Permissions of a User or Role

Function

This API is used to query the permissions of a user or role.

Calling Method

For details, see Calling APIs.

URI

GET /v1/{project_id}/clusters/{cluster_id}/db-manager/users/{name}/authority

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. To obtain the value, see Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

cluster_id

Yes

String

Definition

Cluster ID. For details about how to obtain the value, see Obtaining the Cluster ID.

Constraints

N/A

Range

N/A

Default Value

N/A

name

Yes

String

Definition

Username or role name.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Definition

Page offset, which starts from 0 (page number minus 1).

Constraints

N/A

Range

Greater than or equal to 0

Default Value

0

limit

No

Integer

Definition

Size of a single page.

Constraints

N/A

Range

N/A

Default Value

1000

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

authority_list

Array of GrantAuthority objects

Definition

Permission details list.

Range

N/A

count

Integer

Definition

Total number of permissions.

Range

N/A

Table 4 GrantAuthority

Parameter

Type

Description

type

String

Definition

Permission type.

Range

N/A

database

String

Definition

Database name.

Range

N/A

schema

String

Definition

Schema name.

Range

N/A

obj_name

String

Definition

Object name.

Range

N/A

all_object

Boolean

Definition

Whether the permission applies for all objects.

Range

N/A

future

Boolean

Definition

Whether the permission applies for future objects.

Range

N/A

future_object_owners

String

Definition

Future object - owner.

Range

N/A

column_name

Array of strings

Definition

Column name.

Range

N/A

privileges

Array of Grant objects

Definition

Permission.

Range

N/A

Table 5 Grant

Parameter

Type

Description

permission

String

Definition

Permission name. The permission varies depending on the database object type.

Range

  • For database: CREATE | CONNECT | TEMPORARY | TEMP ALL PRIVILEGES

  • For schemas: CREATE, USAGE, ALTER, or DROP ALL PRIVILEGES

  • For tables: SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER, ANALYZE, ANALYSE, VACUUM, ALTER, or DROP ALL PRIVILEGES

  • For views: SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER, ANALYZE, ANALYSE, VACUUM, ALTER, or DROP ALL PRIVILEGES

  • For columns: SELECT, INSERT, UPDATE, or REFERENCES ALL PRIVILEGES

  • For functions: EXECUTE ALL PRIVILEGES

  • For sequences: SELECT, UPDATE, or USAGE ALL PRIVILEGES

  • For node groups: CREATE, USAGE, or COMPUTE ALL PRIVILEGES

  • For roles: If role_name is specified, all the permissions of this role are given to a user.

grant_with

Boolean

Definition

Whether a permission is included in the grant options.

Range

N/A

Example Requests

Query the permissions of user1.

GET https://{Endpoint}/v1/05f2cff45100d5112f4bc00b794ea08e/clusters/cc6588d6-8301-4c9a-b0c0-186bb824e8c0/db-manager/users/user1/authority

Example Responses

Status code: 200

User or role list queried.

{
  "authority_list" : [ {
    "type" : "DATABASE",
    "database" : "gaussdb",
    "schema" : null,
    "obj_name" : null,
    "all_object" : false,
    "future" : false,
    "future_object_owners" : null,
    "column_name" : null,
    "privileges" : [ {
      "permission" : "CREATE",
      "grant_with" : false
    }, {
      "permission" : "TEMPORARY",
      "grant_with" : false
    }, {
      "permission" : "CONNECT",
      "grant_with" : false
    } ]
  } ],
  "count" : 2
}

Status Codes

Status Code

Description

200

User or role list queried.

400

Request error.

401

Authentication failed.

403

You do not have required permissions.

417

Internal server error.

500

Internal server error.