Validate data privileges¶
Checks whether the data access permission changes for the specified role are executable without actually modifying the authorization. After adjustment based on the verification results, additional changes still need to be made.
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/iam/roles/{role_id}/data-privileges:validate
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First select the character. Then Query role data permissions, confirm the current authorization status and prepare changes to be verified based on the latest status.
Prepare personal access token and target workspace ID with corresponding permissions for the target workspace.
Request body¶
Replace $WORKSPACE_ID, $ROLE_ID, $CLOUDSIGMA_API_KEY in the example with actual values.
curl -X POST "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/iam/roles/$ROLE_ID/data-privileges:validate" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"request_id": "req-001",
"expected_data_privilege_version": 1,
"mutations": [
{
"operation": "grant",
"action_id": "table.query",
"resource_type": "table",
"resource_id": "1001",
"privilege": "select",
"with_grant_option": false,
"row_column": {
"mode": "keep"
}
}
]
}'
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Target workspace ID. |
|
string |
Yes |
The role ID for which data permissions are to be verified. |
Request body
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
The request ID generated by the caller. Cannot be empty. |
|
integer |
No |
Data permission version used by concurrency checking. The default value is 0, which cannot be less than 0. |
|
array of object |
Yes |
The permission changes to be verified contain at least 1 items. |
|
string |
When the object is provided |
Change type, which can only be grant or revoke. Value: |
|
string |
When the object is provided |
The data operation ID in the permission schema. |
|
string |
When the object is provided |
Resource type, which can only be database or table. Value: |
|
string |
When the object is provided |
The resource ID of the database or table. |
|
string |
When the object is provided |
OmniFabric permission name. Values: |
|
boolean |
No |
Omit this field or send false. true is currently rejected. |
|
object or null |
When table SELECT grant |
Table-level row and column rules. Submit only if you need to set, clear, or preserve row and column rules. |
|
string |
When row_column is provided |
Column and column rule processing methods: keep, set or clear. Values: |
|
object |
When mode=set |
The row and column rules submitted when mode is set. |
|
array of string or null |
No |
A set of prohibited columns. |
|
array of object or null |
No |
Row filtering rules. |
|
string |
No |
Column name. |
|
string |
No |
Conditional connection relationship. |
|
array of object or null |
No |
SQL expression rules. |
|
string |
No |
Comparison operators. |
|
array of string or null |
No |
List of conditional values. |
|
string |
No |
Value matching type. |
with_grant_option can only be omitted or filled in with false. Filling in true will be rejected. This option does not support OmniFabric permission delegation. grant.* in application permissions uses another delegation mechanism.
row_column must be provided when granting SELECT permissions on the table. Retaining existing rules also requires submitting {"mode":"keep"}. This field can be omitted or clear used when revoking permissions. Other permissions do not accept row and column rules.
Provide draft when mode=set, fill in the prohibited access column set (black_column_list) and row filtering rules (rule_list) according to the above request body fields. rule_list is grouped by column, relation uses and or or. The operator of expression_list must be compatible with the matching type, and expression cannot be empty. Only one value can be provided except in and not in.
After the service validates the SQL expression, it uses the expression in the rule. SQL expression cannot be used as resource ID. The actual use of row and column rules also requires database support.
Use the database and table IDs returned by the resource selection interface. The ID must be a positive decimal string in the range int64 without leading zeros, symbols, or spaces. table-001, table names, and UUIDs are not substitutes for resource IDs.
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"valid": true,
"errors": [],
"warnings": [],
"payload_fingerprint": "sha256:example",
"request_id": "req-001",
"trace_id": "trace-001"
}
}
Field |
Type |
Description |
|---|---|---|
|
boolean |
Whether the permission change passes the verification. |
|
array of object |
Validation errors, each item contains error code and field path. |
|
string |
Error or diagnostic code. |
|
string |
The request field path corresponding to the error. |
|
array of string |
Warnings that do not block commits. |
|
string |
A fingerprint that normalizes request content. |
|
string |
Request association ID. |
|
string |
Link tracking ID. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "请求参数无效",
"data": null
}
Field |
Type |
Description |
|---|---|---|
code |
string |
error code. |
msg |
string |
error message. |
data |
null |
—。 |