Skip to content

Resource Permission Details

1. API Description

Use this API to query the permission list for a resource, such as a metric or dimension. The response returns users who have permissions on the resource and the corresponding permission details.

2. API URL

POST http://{anymetrics_host:anymetrics_port}/anymetrics/api/v1/authority/userList

For how to obtain anymetrics_host:anymetrics_port, see Calling APIs.

3. Request Parameters

3.1 Common Request Parameters (HEADERS)

Parameter Type Required Description
tenant-id String Yes Tenant ID. Identifies the tenant that owns the resource
auth-type String Yes Authentication type. Supported values: UID, TOKEN, ACCOUNT, and APIKEY
auth-value String Yes The authentication value that corresponds to auth-type

3.1.1 How to Obtain Common Parameters

To obtain tenant-id, select a metric application in the top navigation bar of Aloudata CAN, choose API Integration from the left-side menu, and copy it from the API Integration page. Set auth-value to the authentication value that corresponds to the selected auth-type.

3.2 Request Body Parameters

Parameter Type Required Description
resourceType String Yes Resource type. DATASET: dataset name, for example order; METRIC: metric code, for example uv_7day; DIMENSION: dimension code, for example dmfa48e4cb69c60912210bc5162ff324; ANALYSIS_VIEW: metric view name, for example order_view; DATASOURCE: data source, for example default_catalog; RESULT_PLAN: materialized plan; WORKBOOK: metric dashboard
resourceId String Yes Resource unique ID (UUID)
resourceName String No Resource name

4. Response Parameters

Parameter Type Description
data Array Permission list data
success Boolean Whether the request succeeded
code String Return status code. 200 indicates success
errorMsg String Error message. null when successful
detailErrorMsg String Detailed error message
traceId String Request trace ID

4.1 data Array Structure

data is an array. Each item represents permission information for one account on the resource and contains the following two parts:

  • authorityResource: permission role and capabilities

  • authorityAccount: basic account information

4.2 authorityAccount (Account Information)

Field Type Description
accountType String Account type (USER)
account String Login account
id String Unique account ID
displayName String Display name
photo String Avatar

4.3 authorityResource (Permission Information)

4.3.1 Basic Fields

Field Type Description
authorityRole String Permission role
authoritySource String Permission source
expiredTime Long / null Expiration time. null indicates no expiration.
extendResourceDTO Object / null Resource from which the permission is inherited
canEdit Boolean Whether the account can edit
canDelete Boolean Whether the account can delete
canUsage Boolean Whether the account can use the resource
canAuth Boolean Whether the account can grant permissions
canTransfer Boolean Whether the account can transfer ownership

4.3.2 authorityRole (Role Definitions)

Role Meaning Description
OWNER Owner Has all permissions on the resource
ADMIN Administrator Can manage the resource
USAGER User Can only use the resource

4.3.3 authoritySource (Permission Source)

Value Meaning Description
DIRECT Direct grant The account is granted permissions on this resource directly
EXTEND Inherited Permissions come from an upper-level resource, such as a category

4.3.4 extendResourceDTO (Present Only When authoritySource = EXTEND)

When authoritySource = EXTEND, this field describes the resource from which the permission is inherited.

Field Type Description
resourceType String Source resource type
resourceId String Source resource ID
resourceName String Source resource name. May be empty.

5. Request Example

curl --location 'http://localhost:8083/anymetrics/api/v1/authority/userList' \
--header 'tenant-id: tn_21571046' \
--header 'auth-value: authority_test' \
--header 'auth-type: ACCOUNT' \
--header 'Content-Type: application/json' \
--data '{
  "resourceType": "METRIC",
  "resourceId": "mc1b097411fb64f0d4034605fb4e687d"
}'

6. Response Example

{
    "data": [
        {
            "authorityResource": {
                "authorityRole": "OWNER",
                "expiredTime": null,
                "authoritySource": "EXTEND",
                "extendResourceDTO": {
                    "resourceType": "CATEGORY_METRIC",
                    "resourceId": "3f311c51-7c36-4f80-9973-b86cd2d5c1dc",
                    "resourceName": null
                },
                "canEdit": true,
                "canDelete": true,
                "canUsage": true,
                "canAuth": true,
                "canTransfer": true
            },
            "authorityAccount": {
                "accountType": "USER",
                "account": "jm",
                "id": "463663891121963008",
                "displayName": "CAN_A",
                "photo": null
            }
        },
        {
            "authorityResource": {
                "authorityRole": "OWNER",
                "expiredTime": null,
                "authoritySource": "EXTEND",
                "extendResourceDTO": {
                    "resourceType": "CATEGORY_METRIC",
                    "resourceId": "3f311c51-7c36-4f80-9973-b86cd2d5c1dc",
                    "resourceName": null
                },
                "canEdit": true,
                "canDelete": true,
                "canUsage": true,
                "canAuth": true,
                "canTransfer": true
            },
            "authorityAccount": {
                "accountType": "USER",
                "account": "jingming04",
                "id": "495992141479149568",
                "displayName": "CAN_E",
                "photo": null
            }
        },
        {
            "authorityResource": {
                "authorityRole": "USAGER",
                "expiredTime": null,
                "authoritySource": "EXTEND",
                "extendResourceDTO": {
                    "resourceType": "CATEGORY_METRIC",
                    "resourceId": "3f311c51-7c36-4f80-9973-b86cd2d5c1dc",
                    "resourceName": null
                },
                "canEdit": false,
                "canDelete": false,
                "canUsage": true,
                "canAuth": false,
                "canTransfer": false
            },
            "authorityAccount": {
                "accountType": "USER",
                "account": "jm",
                "id": "582150047047614464",
                "displayName": "CAN_F",
                "photo": null
            }
        },
        {
            "authorityResource": {
                "authorityRole": "OWNER",
                "expiredTime": null,
                "authoritySource": "DIRECT",
                "extendResourceDTO": null,
                "canEdit": true,
                "canDelete": true,
                "canUsage": true,
                "canAuth": true,
                "canTransfer": true
            },
            "authorityAccount": {
                "accountType": "USER",
                "account": "jm",
                "id": "463663891121963008",
                "displayName": "CAN_A",
                "photo": null
            }
        }
    ],
    "success": true,
    "code": "200",
    "errorMsg": null,
    "detailErrorMsg": null,
    "traceId": "a1b80defcb9a44b0bc5108686229839e.195.17678368883570017"
}