查询角色列表
功能介绍
该接口提供查询角色列表功能,包括角色中的权限策略,权限通过角色(Role)来表达,一个Role代表成一组action。
URI
GET /v3/roles
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
domain_id |
否 |
String |
账号ID。
说明:
|
|
name |
否 |
String |
系统内部权限名。(非控制台权限展示名“display_name”) |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
Content-Type |
是 |
String |
该字段内容填为“application/json;charset=utf8”。 |
|
X-Auth-Token |
是 |
String |
拥有Security Administrator权限的token。 |
响应参数
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
Object |
资源链接信息。 |
|
|
Array of objects |
权限信息列表。 |
|
|
total_number |
Integer |
返回权限的总数。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
domain_id |
String |
权限所属账号ID。 |
|
flag |
String |
该参数值为fine_grained时,标识此权限为系统内置的策略。 |
|
description_cn |
String |
权限的中文描述信息。 |
|
catalog |
String |
权限所在目录。 |
|
name |
String |
权限名。携带在用户的token中,云服务根据该名称来判断用户是否有权限访问。 |
|
description |
String |
权限描述信息。 |
|
Object |
权限的资源链接信息。 |
|
|
id |
String |
权限ID。 |
|
display_name |
String |
权限展示名。 |
|
type |
String |
权限的显示模式。
说明:
|
|
Object |
权限的具体内容。 |
|
|
updated_time |
String |
权限更新时间。 |
|
created_time |
String |
权限创建时间。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
Array of objects |
该权限所依赖的权限。 |
|
|
Array of objects |
授权语句,描述权限的具体内容。 |
|
|
Version |
String |
权限版本号。
说明:
|
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
Action |
Array of strings |
授权项,指对资源的具体操作权限,不超过100个。
说明:
|
|
Effect |
String |
作用。包含两种:允许(Allow)和拒绝(Deny),既有Allow又有Deny的授权语句时,遵循Deny优先的原则。 取值范围:
|
|
Condition |
Object |
限制条件。不超过10个。 |
|
Resource |
Array of strings |
资源。数组长度不超过10,每个字符串长度不超过128,规则如下:
说明:
|
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
attribute |
Array of strings |
条件键。key为与运算符有对应关系的合法属性,value为长度不超过10的字符串数组。 该参数类型为自定义字符串数组。 |
请求示例
GET https://sample.domain.com/v3/roles
响应示例
状态码为 200 时:
请求成功。
{
"roles" : [ {
"domain_id" : null,
"description_cn" : "漏洞扫描服务(VSS)管理员,拥有该服务下的所有权限",
"catalog" : "VulnScan",
"name" : "wscn_adm",
"description" : "Vulnerability Scan Service administrator of tasks and reports.",
"links" : {
"next" : null,
"previous" : null,
"self" : "https://sample.domain.com/v3/roles/0af84c1502f447fa9c2fa18083fbb..."
},
"id" : "0af84c1502f447fa9c2fa18083fbb...",
"display_name" : "VSS Administrator",
"type" : "XA",
"policy" : {
"Version" : "1.0",
"Statement" : [ {
"Action" : [ "WebScan:*:*" ],
"Effect" : "Allow"
} ],
"Depends" : [ {
"catalog" : "BASE",
"display_name" : "Server Administrator"
}, {
"catalog" : "BASE",
"display_name" : "Tenant Guest"
} ]
}
}, {
"domain_id" : null,
"flag" : "fine_grained",
"description_cn" : "微服务引擎服务管理员权限",
"catalog" : "CSE",
"name" : "system_all_34",
"description" : "All permissions of CSE service.",
"links" : {
"next" : null,
"previous" : null,
"self" : "https://sample.domain.com/v3/roles/0b5ea44ebdc64a24a9c372b2317f7..."
},
"id" : "0b5ea44ebdc64a24a9c372b2317f7...",
"display_name" : "CSE Admin",
"type" : "XA",
"policy" : {
"Version" : "1.1",
"Statement" : [ {
"Action" : [ "cse:*:*", "ecs:*:*", "evs:*:*", "vpc:*:*" ],
"Effect" : "Allow"
} ]
}
} ],
"links" : {
"next" : null,
"previous" : null,
"self" : "https://sample.domain.com/v3/roles"
},
"total_number" : 300
}
状态码
|
状态码 |
说明 |
|---|---|
|
200 |
请求成功。 |
|
400 |
参数无效。 |
|
401 |
认证失败。 |
|
403 |
没有操作权限。 |