更新时间:2025-09-08 GMT+08:00

更新仓库权限

功能介绍

更新仓库权限

调用方法

请参见如何调用API

URI

PUT /cloudartifact/v5/repositories/{role_id}/privileges

表1 路径参数

参数

是否必选

参数类型

描述

role_id

String

参数解释:

角色id。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

请求参数

表2 请求Body参数

参数

是否必选

参数类型

描述

privileges

Array of PrivilegeParam objects

参数解释:

权限信息。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

表3 PrivilegeParam

参数

是否必选

参数类型

描述

role_id

String

参数解释:

角色id。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

project_id

String

参数解释:

项目ID,可以从调用API处获取,也可以从控制台获取。获取方式请参考获取项目ID

约束限制:

只能由英文字母、数字组成,且长度为32个字符。

取值范围:

不涉及。

默认取值:

无。

area_service_id

String

参数解释:

地域服务id。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

granted_object_path

String

参数解释:

授权对象路径。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

granted_object_type_id

String

参数解释:

授权对象id。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

operations

String

参数解释:

操作权限,多个权限以英文逗号隔开。

约束限制:

不涉及。

取值范围:

可选值:createrepository,editrepository,restore,deleterepository,physicdelete,restoreall,clearall,deleteorredeploy,downloadorview,import,upload,export。

默认取值:

无。

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

status

String

参数解释:

请求成功、失败状态。

取值范围:

success:请求成功。

error:请求失败。

trace_id

String

参数解释:

请求id,当前请求唯一标识。

取值范围:

数字及中划线(-)组成的字符串。

result

Array of Privilege objects

参数解释:

权限信息。

取值范围:

不涉及。

表5 Privilege

参数

参数类型

描述

role_id

String

参数解释:

角色id。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

role_name

String

参数解释:

角色名称。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

role_chinese_name

String

参数解释:

角色中文名。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

project_id

String

参数解释:

项目id。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

area_service_id

String

参数解释:

地域服务id。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

granted_object_path

String

参数解释:

授权对象路径。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

granted_object_type_id

String

参数解释:

授权对象id。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

operations

String

参数解释:

操作权限,多个权限以英文逗号隔开。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

operations_index

Array of integers

参数解释:

操作权限索引。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

无。

请求示例

更新仓库权限

https://{URL}/cloudartifact/v5/repositories/6aa36d3dc51e4c0xxxx4da3047306/privileges

{
  "privileges" : [ {
    "granted_object_type_id" : "f1ba90c4xxxxaec9316b45408921",
    "granted_object_path" : "/codeartsartifact/artifact/component/xx-xxx-x_09d2ca2fxxxx0f51c00ae5bad0a0_docker2_5_27",
    "operations" : "downloadorview,export,import",
    "project_id" : "73e0adda5axxx8a1f869ec2a28a06",
    "role_id" : "6aa36d3dc51e4cxxx54da3047306",
    "area_service_id" : "c0ec24a43xxxx07785d882cf23a"
  }, {
    "granted_object_type_id" : "f9fa2e820725xxx0b1fa99ce931e",
    "granted_object_path" : "/codeartsartifact/artifact/repo/xx-xxx-x_09d2ca2f5080d5xxxxe5bad0a0_docker2_5_27",
    "operations" : "editrepository,restore,physicdelete,createrepository,restoreall",
    "project_id" : "73e0adda5acxxx1f869ec2a28a06",
    "role_id" : "6aa36d3dc51e4xxxx54da3047306",
    "area_service_id" : "c0ec24a435a640xxxx7785d882cf23a"
  } ]
}

响应示例

状态码:200

OK

{
  "status" : "success",
  "trace_id" : "20dadb7a95e34xxxxx60e1736ba771",
  "result" : [ {
    "operations" : "downloadorview,export,import",
    "role_id" : "6aa36d3dc51exxx4e154da3047306",
    "role_name" : null,
    "role_chinese_name" : null,
    "project_id" : "73e0adda5ace41f28xxxec2a28a06",
    "area_service_id" : "c0ec24a435a64xxx07785d882cf23a",
    "granted_object_path" : "/codeartsartifact/artifact/component/xx-xxx-x_09d2ca2f5xxxb60f51c00ae5bad0a0_docker2_5_27",
    "granted_object_type_id" : "f1ba90c49e17xxxc9316b45408921",
    "operations_index" : null
  }, {
    "operations" : "editrepository,restore,physicdelete,createrepository,restoreall",
    "role_id" : "6aa36d3dc51e4c088xxxxda3047306",
    "role_name" : null,
    "role_chinese_name" : null,
    "project_id" : "73e0adda5ace41xxxec2a28a06",
    "area_service_id" : "c0ec24a435a640xxxxd882cf23a",
    "granted_object_path" : "/codeartsartifact/artifact/repo/xx-xxx-x_09d2ca2f508xxxx51c00ae5bad0a0_docker2_5_27",
    "granted_object_type_id" : "f9fa2e8207254xxxxa0b1fa99ce931e",
    "operations_index" : null
  } ]
}

状态码

状态码

描述

200

OK

错误码

请参见错误码