Updated on 2025-02-25 GMT+08:00

Listing Dataset Permissions

Function

This API is used to list dataset permissions.

URI

GET /v1/{project_id}/datasets/{dataset_id}/permissions

Table 1 URI parameter

Parameter

Mandatory

Type

Description

dataset_id

Yes

String

Dataset ID.

project_id

Yes

String

Project ID.

For how to obtain a project ID, see Obtaining a Project ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

permission_type

Yes

String

Permission type. The options are ROW (row permission) and COLUMN (column permission).

offset

Yes

Integer

Offset of pagination. The value 0 indicates no offset, that is, the first page. The value 1 indicates that the offset is 1, that is, the second page.

limit

Yes

Integer

Maximum number of returned items allowed.

sort_key

No

String

Sorting field. The value is isOpen, indicating that whether to enable row and column permissions.

sort_dir

No

String

Sorting type. The options are desc and asc. desc indicates the descending order, and asc indicates the ascending order.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Workspace-Id

Yes

String

Workspace ID. For how to obtain it, see Obtaining a Workspace ID.

X-Auth-Token

Yes

String

User token. Obtain a user token by calling IAM's "Obtaining a User Token" API. X-Subject-Token in the response header is the desired user token.

Response Parameters

Table 4 Response body parameters

Parameter

Type

Description

count

Integer

Total data volume.

page_data

Array of objects

Data. For details, see Table 5.

Table 5 page_data

Parameter

Type

Description

id

String

Primary key ID.

name

String

Name.

dataset_id

String

Dataset ID.

is_open

Boolean

Whether to enable row and column permissions. The default value is true.

permission_type

String

Permission type. ROW indicates that permissions are restricted by row in a database table, and COLUMN indicates that permissions are restricted by column in a database table.

rule_type

String

Rule type. When permission_type is set to ROW, the options are BY_CONDITION and BY_TAG. When permission_type is set to COLUMN, the options are FORBID and MASK.

rule_scope

String

Rule range. ALL indicates that the rule applies to all users. ALL_NO indicates that the rule does not apply to any user. SPECIFIED indicates that the rule only applies to specified users. SPECIFIED_NOT indicates that the rule does not apply to specified users.

rule_user

object

Description of the user the rule applies to. For details, see Table 6.

rule_content

object

Detailed information about row and column permissions. For row permissions, the DatasetRowPermissionRuleVo model is used. For column permissions, the DatasetColumnPermissionRuleVo model is used. For details, see Table 7.

display_fields

object

Display fields. For details, see Table 11.

Table 6 rule_user

Parameter

Type

Description

users

Array of strings

User.

user_groups

Array of strings

User group.

Table 7 rule_content

Parameter

Type

Description

last

Integer

End position of characters to be processed under custom circumstances.

first

Integer

Start position of characters to be processed under custom circumstances.

mask_type

String

Data masking type.

column_ids

Array of strings

List of effective field IDs.

special_words

Array of strings

Special character list specified by the data masking type.

logic_operator

String

Relationship between sub-conditions at the current level. The options include AND and OR.

Minimum length: 0 characters

Maximum length: 20 characters

Enumerated values:

  • AND
  • OR

condition_node

Object

Conditions.

sub_conditions

Array of RowPermissionDescribe objects

Row condition list, and the conditions can be nested.

Table 8 RowPermissionDescribe

Parameter

Type

Description

logic_operator

String

Relationship between sub-conditions at the current level. The options include AND and OR.

Enumerated values:

  • AND
  • OR

condition_node

condition_node object

Conditions.

sub_conditions

Array of RowPermissionDescribe objects

Row condition list.

Table 9 condition_node

Parameter

Type

Description

column_id

String

Field ID.

column_name

String

Field name.

is_measure

Boolean

Whether the field is a metric field.

execute_expression

String

Executable function expression.

relation_operator

String

Condition operator. Note: The content in the following brackets is the explanation of the enumerated values and is not part of the condition operators. The options include EQUAL-TO (=), NOT-EQUAL (!=), GREATER-THAN (>), GREATER-THAN-OR-EQUAL-TO (>=), LESS-THAN (<), LESS-THAN-OR-EQUAL-TO (<=), "" (without condition operator), BETWEEN, ABSOLUTE (absolute), IN, NOT-IN, START-WITH, NOT-START-WITH, END-WITH, NOT-END-WITH, CONTAIN, NOT-CONTAIN, NULL (IS NULL), and NOT-NULL (IS NOT NULL).

data_type

String

Field type.

value

value object

Condition value.

Table 10 value

Parameter

Type

Description

values

Array of strings

Value list.

value_type

String

Value type. The options include ENUM, CONDITION, TAG_USER_GROUP, and TAG_USER.

value_names

String

List of value names. Mandatory when value_type is set to TAG_USER_GROUP or TAG_USER.

Table 11 display_fields

Parameter

Type

Description

user_map

Map<String,String>

User description.

group_map

Map<String,String>

User group description.

field_map

Map<String,String>

Field description.

Example Request

GET https://{endpoint}/v1/{project_id}/datasets/{dataset_id}/permissions?limt=10&offset=0&sort_key=isOpen&sort_dir=desc&permission_type=ROW

Example Response

{
  "count" : 3,
  "page_data" : [ {
    "id" : "xxxxfdff-xxxb-xxxx-8f52-e15e35axxxxx",
    "name" : "COLUMN",
    "dataset_id" : "xxxxd682-e129-xxxx-ad8e-673f02xxxxxx",
    "is_open" : true,
    "permission_type" : "COLUMN",
    "rule_type" : "MASK",
    "rule_scope" : "ALL",
    "project_id" : "xxxx703a500dxxxxfb3c00f9fxxxxx",
    "workspace_Id" : "xxxx6703a50xxxxx2fb3c00f9fxxxxxx",
    "rule_user" : {
      "users" : [ ],
      "user_groups" : [ ]
    },
    "rule_content" : {
      "last" : 1,
      "first" : 1,
      "mask_type" : "RETAIN_FIRST_N_LAST_M",
      "column_ids" : [ "xxxxe9d6-6xxx-4126-bxxx-36fcxxxxce54.amount" ],
      "special_words" : [ "xxx" ]
    },
    "display_fields" : {
      "user_map" : { },
      "group_map" : { },
      "field_map" : {
        "xxxxe9d6-xxxe-4126-bd51-36fc0ee3ce54.amount" : "amount"
      }
    }
  }, {
    "id" : "xxxxda33-dace-xxxx-8xxx-c6dfaxxxxxf1",
    "name" : "USER_TAG",
    "dataset_id" : "xxxxxd13-cxxx-4xxx-b657-829axxxxx20e",
    "is_open" : true,
    "permission_type" : "ROW",
    "rule_type" : "BY_TAG",
    "rule_scope" : "ALL",
    "rule_user" : {
      "users" : [ ],
      "user_groups" : [ ]
    },
    "rule_content" : {
      "condition_node" : null,
      "logic_operator" : "AND",
      "sub_conditions" : [ {
        "condition_node" : {
          "value" : {
            "values" : [ "xxxx3355-xxxx-4340-9b5d-0bd856xxxxxx" ],
            "value_type" : "TAG_USER_GROUP",
            "value_names" : [ "userGroup2" ]
          },
          "column_id" : "xxxxx722-b74c-4xxx-9630-43ca65xxxxxx.buyer_name",
          "is_measure" : false,
          "column_name" : "buyer_name",
          "relation_operator" : ""
        },
        "logic_operator" : null
      }, {
        "condition_node" : {
          "value" : {
            "values" : [ "xxxxx355-4ffa-xxxx-9b5d-0bd856xxxxx" ],
            "value_type" : "TAG_USER_GROUP",
            "value_names" : [ "userGroup2" ]
          },
          "column_id" : "xxxxx22-b74c-4752-xxx0-xxxx65d0d12c.buyer_name",
          "is_measure" : false,
          "column_name" : "buyer_name",
          "relation_operator" : ""
        },
        "logic_operator" : null
      } ]
    },
    "display_fields" : null
  }, {
    "id" : " xxx14b04-ef3d-4ebc-a9ee-c651f563d67c",
    "name" : "Test",
    "dataset_id" : "xxxx4d13-c2a3-426f-b657-829addaxxxxx",
    "is_open" : true,
    "permission_type" : "ROW",
    "rule_type" : "BY_CONDITION",
    "rule_scope" : "SPECIFIED",
    "rule_user" : {
      "users" : [ "xxxxxxxed1b94534xxxxx3de304axxxx", "xxxx987b3dc4xxxx68b8dff1e7xxxxx", "774d5axxxxxb4950aabc8651308xxxxx" ],
      "user_groups" : [ ]
    },
    "rule_content" : {
      "condition_node" : null,
      "logic_operator" : "AND",
      "sub_conditions" : [ {
        "condition_node" : {
          "value" : {
            "values" : [ "123" ],
            "value_type" : "CONDITION"
          },
          "column_id" : "xxxx6722-b74c-4752-9xxx-43ca65d0d12xxxxx.buyer_name",
          "is_measure" : false,
          "column_name" : "buyer_name",
          "relation_operator" : "CONTAIN"
        },
        "logic_operator" : null
      }, {
        "condition_node" : null,
        "logic_operator" : "OR",
        "sub_conditions" : [ {
          "condition_node" : {
            "value" : {
              "values" : [ "qwe" ],
              "value_type" : "CONDITION"
            },
            "column_id" : "xxxx722-b74c-4752-xxxx-43ca65dxxxxx.buyer_name",
            "is_measure" : false,
            "column_name" : "buyer_name",
            "relation_operator" : "CONTAIN"
          },
          "logic_operator" : null
        } ]
      } ]
    },
    "display_fields" : {
      "user_map" : {
        "xxxx987b3dc4xxxxxxb8dff1e73xxxx" : "auth_test",
        "xxxxxac55eeb4950axxxx6513080xxxx" : "chenxiantao",
        "xxxxx57ed1b9453xxxx943de304xxxxx" : "abac_test"
      },
      "group_map" : { },
      "field_map" : null
    }
  } ]
}

Status Codes

Table 12 Status code

Status Code

Description

200

The dataset permission configuration information is successfully retrieved.

Error Codes

See Error Codes.