查询对象权限及授权来源

查看对象的所有者、直接授权和全范围授权来源。该入口不选择单一角色,也不返回可编辑状态。

GET https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/iam/permissions/objects/{resource_type}/{resource_id}/permission-view

调用前准备

先选择要查看的对象。

准备可访问目标工作区的个人访问令牌和目标工作区 ID。

请求参数

curl -X GET "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/iam/permissions/objects/$RESOURCE_TYPE/$RESOURCE_ID/permission-view" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"

参数

类型

是否必填

说明

workspace_id

string

是

目标工作区 ID。

resource_type

string

是

目标资源类型。

resource_id

string

是

目标资源 ID。

成功响应

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "workspace_id": "workspace-001",
    "resource_type": "workflow",
    "resource_id": "workflow-001",
    "owner": {
      "role_id": "role-owner",
      "ownership_version": 0,
      "ownership_status": "active",
      "ownership_audit_id": "",
      "created_by_principal": "",
      "created_by_role_id": ""
    },
    "capabilities": {
      "owner_included": true,
      "direct_specific_grants_included": true,
      "all_scope_grants_included": true,
      "inherited_grants_included": false,
      "system_sources_included": false,
      "matrixone_data_privileges_included": false,
      "editable_state_included": false
    },
    "direct_grants": [],
    "all_scope_grants": [],
    "request_id": "req-001",
    "trace_id": "trace-001"
  }
}

字段

类型

说明

code

string

成功代码。

msg

string

响应信息。

data

object

本次操作返回的数据。

data.workspace_id

string

对象所属工作区 ID。

data.resource_type

string

对象资源类型。

data.resource_id

string

对象资源 ID。

data.owner

JSON 值

对象的直接所有者及所有权版本。

data.owner.role_id

string

角色 ID。

data.owner.ownership_version

integer

所有权版本。

data.owner.ownership_status

string

所有权状态。取值为 active、deleting、absent

data.owner.ownership_audit_id

string

关联标识。

data.owner.created_by_principal

string

创建者主体标识。

data.owner.created_by_role_id

string

关联标识。

data.capabilities

JSON 值

当前权限视图包含的数据来源标记。

data.capabilities.owner_included

boolean

是否包含所有者视图。

data.capabilities.direct_specific_grants_included

boolean

是否包含直接对象授权。

data.capabilities.all_scope_grants_included

boolean

是否包含全范围授权。

data.capabilities.inherited_grants_included

boolean

是否包含继承授权。

data.capabilities.system_sources_included

boolean

是否包含系统来源。

data.capabilities.matrixone_data_privileges_included

boolean

是否包含 MatrixOne 数据权限。

data.capabilities.editable_state_included

boolean

是否包含可编辑状态。

data.direct_grants

object(对象数组)

直接作用于该对象的授权。

data.direct_grants[].role_id

string

角色 ID。

data.direct_grants[].policy_version

integer

策略版本。

data.direct_grants[].statement_id

string

关联标识。

data.direct_grants[].statement_kind

string

策略语句类型。取值为 action、grant_action

data.direct_grants[].action_id

string

关联标识。

data.direct_grants[].resource_type

string

资源类型。

data.direct_grants[].scope_mode

string

授权范围模式。取值为 all、resources、parent、path_prefix

data.direct_grants[].resource_id

string

资源 ID。

data.direct_grants[].resource_key

string

资源定位键。

data.direct_grants[].grant_index_key

string

授权索引键。

data.direct_grants[].condition_hash

string

条件标记。

data.direct_grants[].target_action_id

string

关联标识。

data.direct_grants[].grant_scope_mode

string

授权转授范围。取值为 空字符串、all、resources、parent、path_prefix

data.direct_grants[].grant_delegatable

boolean

是否允许继续转授。

data.all_scope_grants

object(对象数组)

覆盖该对象的全范围授权。

data.all_scope_grants[].role_id

string

角色 ID。

data.all_scope_grants[].policy_version

integer

策略版本。

data.all_scope_grants[].statement_id

string

关联标识。

data.all_scope_grants[].statement_kind

string

策略语句类型。取值为 action、grant_action

data.all_scope_grants[].action_id

string

关联标识。

data.all_scope_grants[].resource_type

string

资源类型。

data.all_scope_grants[].scope_mode

string

授权范围模式。取值为 all、resources、parent、path_prefix

data.all_scope_grants[].resource_id

string

资源 ID。

data.all_scope_grants[].resource_key

string

资源定位键。

data.all_scope_grants[].grant_index_key

string

授权索引键。

data.all_scope_grants[].condition_hash

string

条件标记。

data.all_scope_grants[].target_action_id

string

关联标识。

data.all_scope_grants[].grant_scope_mode

string

授权转授范围。取值为 空字符串、all、resources、parent、path_prefix

data.all_scope_grants[].grant_delegatable

boolean

是否允许继续转授。

data.request_id

string

请求关联 ID。

data.trace_id

string

链路追踪 ID。

错误响应

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

字段

类型

说明

code

string

错误代码。

msg

string

错误信息。

data

null

—。

常见 HTTP 错误

HTTP 状态码

错误代码

常见原因

建议操作

400

ErrParamInvalid、ErrWorkspaceRequired、ErrIAMExplicitRoleInvalid、ErrIAMScopeInvalid、ErrIAMGrantScopeInvalid、ErrIAMResourcePickerInvalid

请求字段、工作区或操作前置条件无效。

修正参数后再提交。

401

Unauthorized、ErrUnauthenticated

认证凭据缺失或无效。

检查凭据类型、有效期及认证头。

403

ErrIAMDenied、ErrIAMPolicyDenied、ErrIAMDataPrivilegeDenied、ErrIAMObjectGrantDenied、ErrIAMResourcePickerDenied、ErrForbidden

当前身份或有效角色无执行该操作的权限。

使用有权限的身份,或联系管理员授权。

404

ErrNotFound、ErrIAMResourceNotFound

目标对象或所需引用未找到。

核对对象标识、所属工作区和当前状态。

409

ErrIAMConflict、ErrIAMPolicyConflict、ErrIAMDataPrivilegeConflict、ErrIAMObjectGrantConflict、ErrIAMResourcePickerConflict

资源状态、请求内容或并发条件冲突。

重新读取当前状态和版本,按实际结果处理。

500

ErrServer

内部处理失败;写操作可能已有部分效果。

保留请求和追踪信息,先核对当前结果。

503

ErrServiceUnavailable、ErrIAMManagementUnavailable、ErrIAMPolicyUnavailable、ErrIAMDataPrivilegeUnavailable、ErrIAMObjectPermissionUnavailable、ErrIAMResourcePickerUnavailable

业务、运行时或授权依赖暂不可用。

恢复依赖后先核对已有结果,不自动重复写入。

最后更新于