ListUserResources - 获取用户有权限的资源

更新时间:
复制 MD 格式

获取指定用户名下的有权限的代码库和代码组信息,以及角色信息,支持分页,以用户维度进行分页。请注意,仅限企业管理员以上权限的用户可调用。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求语法

GET /api/v4/user/vision/user_resources HTTP/1.1

请求参数

名称

类型

必填

描述

示例值

organizationId

string

是

企业标识,也称企业 id,字符串形式,可在云效访问链接中获取,如 https://devops.aliyun.com/organization/【OrganizationId】

5ebbc0228123212b59xxxxx

accessToken

string

否

个人访问令牌。 使用阿里云 AK+SK 或使用 STS 临时授权方式不需要传该字段

f0b1e61db5961df5975a93f9129d2513

userIds

string

否

用户的阿里云账号 ID 列表,多个账号以逗号隔开

1,2,3

page

integer

否

页码,默认值为 1,从第 1 页开始

1

pageSize

integer

否

每页大小,默认值为 20,取值范围【1,100】

10

返回参数

名称

类型

描述

示例值

object

Schema of Response

requestId

string

请求 ID

A35869D5-BB29-5F84-A4DD-B09985EA2AFA

success

boolean

请求是否成功

true

errorMessage

string

错误信息

”“

errorCode

string

错误码

success

total

integer

总记录数

2

result

array<object>

返回结果列表

array<object>

返回结果

userInfo

object

用户信息

id

integer

用户 ID

19230

name

string

用户名称

test-codeup

username

string

用户登录名

test-codeup

state

string

用户状态,可选值:

  • active

  • blocked

active

avatarUrl

string

头像地址

https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100

email

string

用户邮箱

username@example.com

groupInfos

array<object>

用户有权限的代码组列表

array<object>

代码组与角色信息

groupInfo

object

代码组信息

id

integer

代码组 ID

35268

name

string

代码组名称

test-group

path

string

代码组路径

test-group

nameWithNamespace

string

代码组完整名称(含完整组名称)

test-org / test-group(斜杠两侧有空格)

pathWithNamespace

string

代码组完整路径(含父路径)

test-org/test-group

parentId

integer

父路径 ID

1183319

ownerId

integer

代码组拥有者 ID

1234

createdAt

string

创建时间,采用 ISO 8601 格式并包含时区偏移。

2022-01-14T21:08:26+08:00

updatedAt

string

更新时间,采用 ISO 8601 格式并包含时区偏移。

2022-01-14T21:08:26+08:00

visibilityLevel

integer

代码组的可见性

  • 0:私有

  • 10:企业可见

0

description

string

代码组的描述信息

test-group

groupRole

object

用户在代码组的角色信息

sourceId

integer

关联的 ID,指代码库或代码组 ID

35268

sourceType

string

关联的类型,可选值:

  • Project:指代码库

  • Namespace:指代码组

Namespace

accessLevel

integer

权限类型

  • 20:浏览者

  • 30:开发者

  • 40:管理员

40

cnRoleName

string

角色中文名

  • 浏览者

  • 开发者

  • 管理员

管理员

enRoleName

string

角色英文名

  • Viewer - 浏览者

  • Developer - 开发者

  • Admin - 管理员

Admin

repositoryInfos

array<object>

用户有权限的代码库列表

array<object>

代码库与角色信息

repositoryInfo

object

代码库信息

id

integer

代码库 ID

37229

name

string

代码库名称

test-repo

path

string

代码库路径

test-repo

description

string

代码库描述

具体的描述内容

nameWithNamespace

string

代码库完整名称(含完整组名称)

test-org / test-group / test-repo(斜杠两侧有空格)

pathWithNamespace

string

代码库完整路径(含完整组路径)

test-org/test-group/test-repo

visibilityLevel

integer

可见性

  • 0:私有,仅代码库成员可见

  • 10:企业内公开,企业成员可见

0

lastActivityAt

string

最后活跃时间

2022-01-14T21:08:26+08:00

namespaceId

integer

上级路径的 ID

600002

accessLevel

integer

成员权限

  • 20:浏览者

  • 30:开发者

  • 40:管理员

40

createdAt

string

创建时间,采用 ISO 8601 格式并包含时区偏移。

2022-01-14T21:08:26+08:00

updatedAt

string

更新时间,采用 ISO 8601 格式并包含时区偏移。

2022-01-14T21:08:26+08:00

archived

boolean

归档标识

false

creatorId

integer

创建者 ID

12679

encrypted

boolean

加密标识

false

repositoryRole

object

用户在代码库的角色信息

sourceId

integer

来源 ID,指代码库或代码组 ID

37229

sourceType

string

关联的类型,可选值:

  • Project:指代码库

  • Namespace:指代码组

Project

accessLevel

integer

权限类型

  • 20:浏览者

  • 30:开发者

  • 40:管理员

40

cnRoleName

string

角色中文名

  • 浏览者

  • 开发者

  • 管理员

管理员

enRoleName

string

角色英文名

  • Viewer - 浏览者

  • Developer - 开发者

  • Admin - 管理员

Admin

示例

正常返回示例

JSON格式

{
  "requestId": "A35869D5-BB29-5F84-A4DD-B09985EA2AFA",
  "success": true,
  "errorMessage": "”“",
  "errorCode": "success",
  "total": 2,
  "result": [
    {
      "userInfo": {
        "id": 19230,
        "name": "test-codeup",
        "username": "test-codeup",
        "state": "active",
        "avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100",
        "email": "username@example.com"
      },
      "groupInfos": [
        {
          "groupInfo": {
            "id": 35268,
            "name": "test-group",
            "path": "test-group",
            "nameWithNamespace": "test-org / test-group(斜杠两侧有空格)",
            "pathWithNamespace": "test-org/test-group",
            "parentId": 1183319,
            "ownerId": 1234,
            "createdAt": "2022-01-14T21:08:26+08:00\n",
            "updatedAt": "2022-01-14T21:08:26+08:00\n",
            "visibilityLevel": 0,
            "description": "test-group"
          },
          "groupRole": {
            "sourceId": 35268,
            "sourceType": "Namespace",
            "accessLevel": 40,
            "cnRoleName": "管理员",
            "enRoleName": "Admin"
          }
        }
      ],
      "repositoryInfos": [
        {
          "repositoryInfo": {
            "id": 37229,
            "name": "test-repo",
            "path": "test-repo",
            "description": "具体的描述内容",
            "nameWithNamespace": "test-org / test-group / test-repo(斜杠两侧有空格)",
            "pathWithNamespace": "test-org/test-group/test-repo",
            "visibilityLevel": 0,
            "lastActivityAt": "2022-01-14T21:08:26+08:00\n",
            "namespaceId": 600002,
            "accessLevel": 40,
            "createdAt": "2022-01-14T21:08:26+08:00",
            "updatedAt": "2022-01-14T21:08:26+08:00",
            "archived": false,
            "creatorId": 12679,
            "encrypted": false
          },
          "repositoryRole": {
            "sourceId": 37229,
            "sourceType": "Project",
            "accessLevel": 40,
            "cnRoleName": "管理员",
            "enRoleName": "Admin"
          }
        }
      ]
    }
  ]
}

错误码

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。