列出权限信息¶
GET /api/v1/permission/list
概述¶
读取目标工作空间可用于角色配置的权限目录。
调用前和使用步骤¶
要配置自定义角色时,可用 isSupportCustomRole=true 取可选权限项,再读取 subs 中的 key。返回的是权限目录和适用范围;要查询某角色已授予的权限,请读取该角色详情。
从站点域名表选择所属站点的 OpenAPI 地址。
请求头¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| DF-API-KEY | string | Y | 工作空间的 OpenAPI Key 凭据。使用完整密钥值,不使用 API Key 记录的 UUID。 例子: <DF-API-KEY>获取或填写方式: 在目标工作空间的 API Key 管理中创建或获取具备本接口权限的 Key。 |
Query 请求参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| isSupportCustomRole | boolean | 省略时不过滤,true 只返回支持自定义角色的权限项,false 只返回不支持的项。没有匹配项的分组会省略。 允许 null: False 例子: true获取或填写方式: 按表单需要选择是否只展示可配置到自定义角色的权限。 |
参数补充说明¶
工作空间由请求中的 DF-API-KEY 确定。
请求例子¶
curl --get -H "DF-API-KEY: <DF-API-KEY>" \
"https://openapi.guance.com/api/v1/permission/list" \
--data-urlencode "isSupportCustomRole=true"
响应¶
HTTP 200,application/json。
| 字段 | 类型 | 说明 |
|---|---|---|
| content | array<object> |
本页结果,没有记录时为空数组。 |
| content[].key | string | 权限标识,可出现在角色详情的 permissions 中。 |
| content[].name | string | 权限显示名称。 |
| content[].desc | string | 权限功能说明。 |
| content[].disabled | integer | 不可选标识。支持自定义角色选用时为 0,否则为 1。 |
| content[].forbidWorkspaceVersion | array<string> |
配置为禁用的空间版本。 |
| content[].isSupportOwner | integer | 是否适用于拥有者。 1 表示支持,0 表示不支持。 |
| content[].isSupportWsAdmin | integer | 是否适用于管理员。 1 表示支持,0 表示不支持。 |
| content[].isSupportGeneral | integer | 是否适用于标准成员。 1 表示支持,0 表示不支持。 |
| content[].isSupportReadOnly | integer | 是否适用于只读成员。 1 表示支持,0 表示不支持。 |
| content[].isSupportAgent | integer | 是否适用于受邀代理身份。 1 表示支持,0 表示不支持。 |
| content[].isSupportCustomRole | integer | 是否支持在自定义角色中选用。 1 表示支持,0 表示不支持。 |
| content[].subPermission | array<string> 或 string |
其他依赖的权限标识。没有依赖时可为空字符串或空数组。 |
| content[].subs | array<object> |
该组满足筛选条件的权限项。 |
| content[].declaration | object 或 null | 工作空间声明,非空结果的公共信息。 |
| content[].subs[].key | string | 权限标识,可出现在角色详情的 permissions 中。 |
| content[].subs[].name | string | 权限显示名称。 |
| content[].subs[].desc | string | 权限功能说明。 |
| content[].subs[].disabled | integer | 不可选标识。支持自定义角色选用时为 0,否则为 1。 |
| content[].subs[].forbidWorkspaceVersion | array<string> |
配置为禁用的空间版本。 |
| content[].subs[].isSupportOwner | integer | 是否适用于拥有者。 1 表示支持,0 表示不支持。 |
| content[].subs[].isSupportWsAdmin | integer | 是否适用于管理员。 1 表示支持,0 表示不支持。 |
| content[].subs[].isSupportGeneral | integer | 是否适用于标准成员。 1 表示支持,0 表示不支持。 |
| content[].subs[].isSupportReadOnly | integer | 是否适用于只读成员。 1 表示支持,0 表示不支持。 |
| content[].subs[].isSupportAgent | integer | 是否适用于受邀代理身份。 1 表示支持,0 表示不支持。 |
| content[].subs[].isSupportCustomRole | integer | 是否支持在自定义角色中选用。 1 表示支持,0 表示不支持。 |
| content[].subs[].subPermission | array<string> 或 string |
其他依赖的权限标识。没有依赖时可为空字符串或空数组。 |
{
"code": 200,
"content": [
{
"key": "workspace.*",
"name": "工作空间",
"desc": "",
"subPermission": "",
"disabled": 1,
"subs": [
{
"key": "workspace.memberManage",
"name": "成员管理",
"desc": "管理空间成员",
"subPermission": "",
"disabled": 0,
"isSupportCustomRole": 1
}
],
"isSupportCustomRole": 0,
"declaration": null
}
],
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
错误响应¶
鉴权、限流和公共请求错误参见公共错误定义。
| HTTP 状态 | errorCode | 触发条件 | 消息或响应说明 | 处理方式 |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | 传入未声明的 Query 参数 | 消息指出无效参数。 | 移除参数表未列出的字段。 |
| 406 | ft.NotFoundWorkspace | 无法找到 API Key 对应工作空间 | 工作空间不存在。 | 核对 Key 所属空间是否有效。 |