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.

HTTP
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.

Shell
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

workspace_id

string

Yes

Target workspace ID.

role_id

string

Yes

The role ID for which data permissions are to be verified.

Request body

Field

Type

Required

Description

request_id

string

Yes

The request ID generated by the caller. Cannot be empty.

expected_data_privilege_version

integer

No

Data permission version used by concurrency checking. The default value is 0, which cannot be less than 0.

mutations

array of object

Yes

The permission changes to be verified contain at least 1 items.

mutations[].operation

string

When the object is provided

Change type, which can only be grant or revoke. Value: grant, revoke.

mutations[].action_id

string

When the object is provided

The data operation ID in the permission schema.

mutations[].resource_type

string

When the object is provided

Resource type, which can only be database or table. Value: database, table.

mutations[].resource_id

string

When the object is provided

The resource ID of the database or table.

mutations[].privilege

string

When the object is provided

OmniFabric permission name. Values: create_table, select, insert, update, delete.

mutations[].with_grant_option

boolean

No

Omit this field or send false. true is currently rejected.

mutations[].row_column

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.

mutations[].row_column.mode

string

When row_column is provided

Column and column rule processing methods: keep, set or clear. Values: keep, set, clear.

mutations[].row_column.draft

object

When mode=set

The row and column rules submitted when mode is set.

mutations[].row_column.draft.black_column_list

array of string or null

No

A set of prohibited columns.

mutations[].row_column.draft.rule_list

array of object or null

No

Row filtering rules.

mutations[].row_column.draft.rule_list[].column

string

No

Column name.

mutations[].row_column.draft.rule_list[].relation

string

No

Conditional connection relationship.

mutations[].row_column.draft.rule_list[].expression_list

array of object or null

No

SQL expression rules.

mutations[].row_column.draft.rule_list[].expression_list[].operator

string

No

Comparison operators.

mutations[].row_column.draft.rule_list[].expression_list[].expression

array of string or null

No

List of conditional values.

mutations[].row_column.draft.rule_list[].expression_list[].match_type

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

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "valid": true,
    "errors": [],
    "warnings": [],
    "payload_fingerprint": "sha256:example",
    "request_id": "req-001",
    "trace_id": "trace-001"
  }
}

Field

Type

Description

data.valid

boolean

Whether the permission change passes the verification.

data.errors

array of object

Validation errors, each item contains error code and field path.

data.errors[].code

string

Error or diagnostic code.

data.errors[].path

string

The request field path corresponding to the error.

data.warnings

array of string

Warnings that do not block commits.

data.payload_fingerprint

string

A fingerprint that normalizes request content.

data.request_id

string

Request association ID.

data.trace_id

string

Link tracking ID.

Error response

JSON
{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效",
  "data": null
}

Field

Type

Description

code

string

error code.

msg

string

error message.

data

null

—。

Last updated on