Configuring Dataset Permissions
Function
This API is used to configure dataset permissions.
URI
POST /v1/{project_id}/datasets/{dataset_id}/permissions
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
dataset_id |
Yes |
String |
Dataset ID. |
project_id |
Yes |
String |
Project ID. |
Request 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. |
Content-Type |
Yes |
String |
Request body type and character set, which have fixed values. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
dataset_permissions |
Yes |
Array of objects |
Dataset permissions. For details, see Table 4. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
id |
Yes |
String |
Primary key ID. |
name |
Yes |
String |
Name. |
dataset_id |
Yes |
String |
Dataset ID. |
is_open |
Yes |
Boolean |
Whether to enable row and column permissions. |
permission_type |
Yes |
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 |
Yes |
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 |
Yes |
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 |
Yes |
object |
Description of the user the rule applies to. For details, see Table 5. |
rule_content |
Yes |
object |
Rule content. For details, see Table 6. |
display_fields |
Yes |
object |
Display fields. For details, see Table 7. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
users |
No |
Array of strings |
User. |
user_groups |
No |
Array of strings |
User group. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
last |
No |
Integer |
End position of characters to be processed under custom circumstances. |
first |
No |
Integer |
Start position of characters to be processed under custom circumstances. |
mask_type |
No |
String |
Data masking type. |
column_ids |
Yes |
Array of strings |
List of effective field IDs. |
special_words |
No |
Array of strings |
Special character list specified by the data masking type. |
Response Parameters
Parameter |
Type |
Description |
---|---|---|
message |
String |
Description. |
Example Request
POST https://{endpoint}/v1/{project_id}/datasets/{dataset_id}/permissions { " dataset_permissions " : [ { "id" : "xxxxfdff-xxxx-43cb-8f52-e15e35axxxxx", "name" : "COLUMN", "dataset_id" : "1e27d682-xxxx-4589-ad8e-673f02d395f4", "is_open" : true, "permission_type" : "COLUMN", "rule_type" : "MASK", "rule_scope" : "ALL", "project_id" : "xxxx6703a500xxxx2fb3c00f9fxxxxxx", "workspace_Id" : "xxxx6703a50xxxxx2fb3c00f9fxxxxxx", "rule_user" : { "users" : [ ], "user_groups" : [ ] }, "rule_content" : { "last" : 1, "first" : 1, "mask_type" : "RETAIN_FIRST_N_LAST_M", "column_ids" : [ "xxxxx9d6-6dae-xxxx-bd51-36fc0exxxxxx.amount" ], "special_words" : [ "xxx" ] }, "display_fields" : { "user_map" : { }, "group_map" : { }, "field_map" : { "xxxxx9d6-6dae-4126-xxxx-36fc0exxxxxx.amount" : "amount" } } }, { "id" : "xxxxxa33-dace-xxxx-8ddf-c6dfa48xxxxx", "name" : "USER_TAG", "dataset_id" : "xxxx4d13-c2a3-xxxx-b657-829addaxxxxx", "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-4ffa-xxxx-9b5d-0bd85668xxxx" ], "value_type" : "TAG_USER_GROUP", "value_names" : [ "userGroup2" ] }, "column_id" : "xxxx6722-b74c-xxxx-9630-43ca65xxxxxx.buyer_name", "is_measure" : false, "column_name" : "buyer_name", "relation_operator" : "" }, "logic_operator" : null }, { "condition_node" : { "value" : { "values" : [ "xxxxx355-4ffa-4340-9b5d-0bd856xxxxx" ], "value_type" : "TAG_USER_GROUP", "value_names" : [ "userGroup2" ] }, "column_id" : "xxxxx722-b74c-4752-xxxx-43ca65dxxxxx.buyer_name", "is_measure" : false, "column_name" : "buyer_name", "relation_operator" : "" }, "logic_operator" : null } ] }, "display_fields" : null }, { "id" : "xxxxxb04-ef3d-4ebc-a9ee-c651f5xxxxxx", "name" : "Test", "dataset_id" : "xxxxxd13-c2a3-426f-xxxx-xxxxxdaba20e", "is_open" : true, "permission_type" : "ROW", "rule_type" : "BY_CONDITION", "rule_scope" : "SPECIFIED", "rule_user" : { "users" : [ "xxxxx57ed1b9453xxxxx43de304xxxxx", "xxxxx987b3dcxxxxb68b8dff1e7xxxxx", "xxxxxac55eeb4950aabc86513080f9ba" ], "user_groups" : [ ] }, "rule_content" : { "condition_node" : null, "logic_operator" : "AND", "sub_conditions" : [ { "condition_node" : { "value" : { "values" : [ "123" ], "value_type" : "CONDITION" }, "column_id" : "xxxx6722-b74c-xxxx-9630-43ca65dxxxxx.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" : "xxxxx722-b74c-xxxx-9630-43ca65dxxxxx.buyer_name", "is_measure" : false, "column_name" : "buyer_name", "relation_operator" : "CONTAIN" }, "logic_operator" : null } ] } ] }, "display_fields" : { "user_map" : { "xxxxx987b3dc4xxxx68b8dff1exxxxxx" : "auth_test", "xxxxxac55eeb4xxxxabc865130xxxxxx" : "chenxiantao", "xxxxx57ed1b94xxxx6c943de30xxxxxx" : "abac_test" }, "group_map" : { }, "field_map" : null } } ] }
Example Response
{ "message" : "success" }
Status Codes
Status Code |
Description |
---|---|
200 |
The configuration is successful. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot