查看项目的角色权限设置 - ListProjectRolePermissions
功能介绍
查看项目的角色权限设置,包含上传下载、创建文件夹、清空或者还原回收站和更改软件包状态等设置。
调用方法
请参见如何调用API。
授权信息
账号根用户具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备如下身份策略权限,更多的权限说明请参见权限和授权项。
|
授权项 |
访问级别 |
资源类型(*为必须) |
条件键 |
别名 |
依赖的授权项 |
|---|---|---|---|---|---|
|
codeartsartifact:releaseRepo:getProjectInfo |
Read |
- |
- |
- |
- |
URI
GET /devreposerver/v5/project-role/permissions
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
String |
参数解释: 项目ID,对应"需求管理 CodeArts Req"项目唯一标识,私有依赖库首页地址栏url https://{host}/cloudartifact/project/{project_id}/repository中project_id变量的值。 约束限制: 字符串长度32。 取值范围: 不涉及。 默认取值: 不涉及。 |
请求参数
无
响应参数
状态码:200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
status |
String |
参数解释: 请求成功或失败状态。 取值范围:
|
|
trace_id |
String |
参数解释: 请求ID,当前请求的唯一标识。 取值范围: 数字及中划线(-)组成的字符串。 |
|
result |
Array of ProjectRolePermissionDo objects |
参数解释: 权限列表。 取值范围: 不涉及。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
id |
String |
参数解释: ID。 取值范围: 不涉及。 |
|
role_id |
Integer |
参数解释: 角色ID。 取值范围: 不涉及。 |
|
devuc_role_id |
String |
参数解释: DEVUC角色ID。 取值范围: 不涉及。 |
|
project_id |
String |
参数解释: 项目ID。 取值范围: 不涉及。 |
|
is_permission_config |
Boolean |
参数解释: 是否具有权限配置能力。 取值范围:
|
|
is_change_pkg_status |
Boolean |
参数解释: 能否更改软件包状态。 取值范围:
|
|
is_upload |
Boolean |
参数解释: 能否进行上传。 取值范围:
|
|
is_delete_restore_test_pkg |
Boolean |
参数解释: 能否删除和还原测试状态的软件包。 取值范围:
|
|
is_delete_restore_prod_pkg |
Boolean |
参数解释: 能否删除和还原生产状态的软件包。 取值范围:
|
|
is_edit_test_pkg |
Boolean |
参数解释: 能否编辑测试状态的软件包。 取值范围:
|
|
is_mkdir |
Boolean |
参数解释: 能否创建文件夹。 取值范围:
|
|
is_download |
Boolean |
参数解释: 能否进行下载。 取值范围:
|
|
is_restore_all |
Boolean |
参数解释: 能否还原回收站。 取值范围:
|
|
is_empty |
Boolean |
参数解释: 能否清空回收站。 取值范围:
|
|
create_time |
Long |
参数解释: 创建时间。 取值范围: 不涉及。 |
|
update_time |
Long |
参数解释: 更新时间。 取值范围: 不涉及。 |
|
migrated_630 |
Integer |
参数解释: 权限迁移状态。 取值范围: 不涉及。 |
|
region |
String |
参数解释: 区域。 取值范围: 不涉及。 |
|
user_id |
String |
参数解释: 用户id。 取值范围: 不涉及。 |
|
roles |
String |
参数解释: 角色。 取值范围: 不涉及。 |
请求示例
查看项目的角色权限设置
https://{URL}/devreposerver/v5/project-role/permissions?project_id=f132b62084774001b84c294c0eef27f2
响应示例
状态码:200
OK
{
"status" : "success",
"trace_id" : "8b1520ec7d254fb5bae9e979e5926d17",
"result" : [ {
"id" : "0019256f4e4611f0b0b6fa163ead7b41",
"region" : "xx-xxxxx-x",
"roles" : null,
"role_id" : -1,
"devuc_role_id" : null,
"project_id" : "f132b62084774001b84c294c0eef27f2",
"is_permission_config" : true,
"is_change_pkg_status" : true,
"is_upload" : true,
"is_delete_restore_test_pkg" : true,
"is_delete_restore_prod_pkg" : true,
"is_edit_test_pkg" : true,
"is_mkdir" : true,
"is_download" : true,
"is_restore_all" : true,
"is_empty" : true,
"create_time" : 1750472301000,
"update_time" : 1750472301000,
"migrated_630" : 0,
"user_id" : null
}, {
"id" : "001929184e4611f0b0b6fa163ead7b41",
"region" : "xx-xxxxx-x",
"roles" : null,
"role_id" : 3,
"devuc_role_id" : null,
"project_id" : "f132b62084774001b84c294c0eef27f2",
"is_permission_config" : true,
"is_change_pkg_status" : true,
"is_upload" : true,
"is_delete_restore_test_pkg" : true,
"is_delete_restore_prod_pkg" : false,
"is_edit_test_pkg" : true,
"is_mkdir" : true,
"is_download" : true,
"is_restore_all" : true,
"is_empty" : true,
"create_time" : 1750472301000,
"update_time" : 1750472301000,
"migrated_630" : 0,
"user_id" : null
}, {
"id" : "001929ce4e4611f0b0b6fa163ead7b41",
"region" : "xx-xxxxx-x",
"roles" : null,
"role_id" : 4,
"devuc_role_id" : null,
"project_id" : "f132b62084774001b84c294c0eef27f2",
"is_permission_config" : false,
"is_change_pkg_status" : false,
"is_upload" : true,
"is_delete_restore_test_pkg" : true,
"is_delete_restore_prod_pkg" : false,
"is_edit_test_pkg" : true,
"is_mkdir" : true,
"is_download" : true,
"is_restore_all" : false,
"is_empty" : false,
"create_time" : 1750472301000,
"update_time" : 1750472301000,
"migrated_630" : 0,
"user_id" : null
}, {
"id" : "00192a6c4e4611f0b0b6fa163ead7b41",
"region" : "xx-xxxxx-x",
"roles" : null,
"role_id" : 5,
"devuc_role_id" : null,
"project_id" : "f132b62084774001b84c294c0eef27f2",
"is_permission_config" : false,
"is_change_pkg_status" : false,
"is_upload" : true,
"is_delete_restore_test_pkg" : true,
"is_delete_restore_prod_pkg" : false,
"is_edit_test_pkg" : true,
"is_mkdir" : true,
"is_download" : true,
"is_restore_all" : true,
"is_empty" : true,
"create_time" : 1750472301000,
"update_time" : 1750472301000,
"migrated_630" : 0,
"user_id" : null
}, {
"id" : "0019499b4e4611f0b0b6fa163ead7b41",
"region" : "xx-xxxxx-x",
"roles" : null,
"role_id" : 6,
"devuc_role_id" : null,
"project_id" : "f132b62084774001b84c294c0eef27f2",
"is_permission_config" : false,
"is_change_pkg_status" : false,
"is_upload" : true,
"is_delete_restore_test_pkg" : false,
"is_delete_restore_prod_pkg" : false,
"is_edit_test_pkg" : false,
"is_mkdir" : true,
"is_download" : true,
"is_restore_all" : false,
"is_empty" : false,
"create_time" : 1750472301000,
"update_time" : 1750472301000,
"migrated_630" : 0,
"user_id" : null
}, {
"id" : "00194a384e4611f0b0b6fa163ead7b41",
"region" : "xx-xxxxx-x",
"roles" : null,
"role_id" : 7,
"devuc_role_id" : null,
"project_id" : "f132b62084774001b84c294c0eef27f2",
"is_permission_config" : false,
"is_change_pkg_status" : false,
"is_upload" : false,
"is_delete_restore_test_pkg" : false,
"is_delete_restore_prod_pkg" : false,
"is_edit_test_pkg" : false,
"is_mkdir" : false,
"is_download" : true,
"is_restore_all" : false,
"is_empty" : false,
"create_time" : 1750472301000,
"update_time" : 1750472301000,
"migrated_630" : 0,
"user_id" : null
}, {
"id" : "00194ab24e4611f0b0b6fa163ead7b41",
"region" : "xx-xxxxx-x",
"roles" : null,
"role_id" : 8,
"devuc_role_id" : null,
"project_id" : "f132b62084774001b84c294c0eef27f2",
"is_permission_config" : false,
"is_change_pkg_status" : false,
"is_upload" : false,
"is_delete_restore_test_pkg" : false,
"is_delete_restore_prod_pkg" : false,
"is_edit_test_pkg" : false,
"is_mkdir" : false,
"is_download" : false,
"is_restore_all" : false,
"is_empty" : false,
"create_time" : 1750472301000,
"update_time" : 1750472301000,
"migrated_630" : 0,
"user_id" : null
}, {
"id" : "00194b454e4611f0b0b6fa163ead7b41",
"region" : "xx-xxxxx-x",
"roles" : null,
"role_id" : 9,
"devuc_role_id" : null,
"project_id" : "f132b62084774001b84c294c0eef27f2",
"is_permission_config" : false,
"is_change_pkg_status" : true,
"is_upload" : true,
"is_delete_restore_test_pkg" : true,
"is_delete_restore_prod_pkg" : true,
"is_edit_test_pkg" : true,
"is_mkdir" : true,
"is_download" : true,
"is_restore_all" : false,
"is_empty" : false,
"create_time" : 1750472301000,
"update_time" : 1750472301000,
"migrated_630" : 0,
"user_id" : null
}, {
"id" : "001f6c194e4611f0b0b6fa163ead7b41",
"region" : "xx-xxxxx-x",
"roles" : null,
"role_id" : 1001,
"devuc_role_id" : null,
"project_id" : "f132b62084774001b84c294c0eef27f2",
"is_permission_config" : false,
"is_change_pkg_status" : false,
"is_upload" : true,
"is_delete_restore_test_pkg" : true,
"is_delete_restore_prod_pkg" : false,
"is_edit_test_pkg" : true,
"is_mkdir" : true,
"is_download" : true,
"is_restore_all" : false,
"is_empty" : false,
"create_time" : 1750472301000,
"update_time" : 1750472301000,
"migrated_630" : 0,
"user_id" : null
}, {
"id" : "00255ae14e4611f0b0b6fa163ead7b41",
"region" : "xx-xxxxx-x",
"roles" : null,
"role_id" : 1002,
"devuc_role_id" : null,
"project_id" : "f132b62084774001b84c294c0eef27f2",
"is_permission_config" : false,
"is_change_pkg_status" : false,
"is_upload" : false,
"is_delete_restore_test_pkg" : true,
"is_delete_restore_prod_pkg" : false,
"is_edit_test_pkg" : true,
"is_mkdir" : true,
"is_download" : true,
"is_restore_all" : false,
"is_empty" : false,
"create_time" : 1750472301000,
"update_time" : 1750472301000,
"migrated_630" : 0,
"user_id" : null
}, {
"id" : "002bd43a4e4611f0b0b6fa163ead7b41",
"region" : "xx-xxxxx-x",
"roles" : null,
"role_id" : 1003,
"devuc_role_id" : null,
"project_id" : "f132b62084774001b84c294c0eef27f2",
"is_permission_config" : false,
"is_change_pkg_status" : false,
"is_upload" : true,
"is_delete_restore_test_pkg" : true,
"is_delete_restore_prod_pkg" : false,
"is_edit_test_pkg" : true,
"is_mkdir" : true,
"is_download" : true,
"is_restore_all" : false,
"is_empty" : false,
"create_time" : 1750472301000,
"update_time" : 1750472301000,
"migrated_630" : 0,
"user_id" : null
}, {
"id" : "0031d0114e4611f0b0b6fa163ead7b41",
"region" : "xx-xxxxx-x",
"roles" : null,
"role_id" : 1004,
"devuc_role_id" : null,
"project_id" : "f132b62084774001b84c294c0eef27f2",
"is_permission_config" : false,
"is_change_pkg_status" : false,
"is_upload" : false,
"is_delete_restore_test_pkg" : false,
"is_delete_restore_prod_pkg" : false,
"is_edit_test_pkg" : false,
"is_mkdir" : false,
"is_download" : true,
"is_restore_all" : false,
"is_empty" : false,
"create_time" : 1750472301000,
"update_time" : 1750472301000,
"migrated_630" : 0,
"user_id" : null
} ]
}
SDK代码示例
SDK代码示例如下。
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.codeartsartifact.v2.region.CodeArtsArtifactRegion; import com.huaweicloud.sdk.codeartsartifact.v2.*; import com.huaweicloud.sdk.codeartsartifact.v2.model.*; public class ListProjectRolePermissionsSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); CodeArtsArtifactClient client = CodeArtsArtifactClient.newBuilder() .withCredential(auth) .withRegion(CodeArtsArtifactRegion.valueOf("<YOUR REGION>")) .build(); ListProjectRolePermissionsRequest request = new ListProjectRolePermissionsRequest(); try { ListProjectRolePermissionsResponse response = client.listProjectRolePermissions(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkcodeartsartifact.v2.region.codeartsartifact_region import CodeArtsArtifactRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkcodeartsartifact.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] credentials = BasicCredentials(ak, sk) client = CodeArtsArtifactClient.new_builder() \ .with_credentials(credentials) \ .with_region(CodeArtsArtifactRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListProjectRolePermissionsRequest() response = client.list_project_role_permissions(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" codeartsartifact "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsartifact/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsartifact/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsartifact/v2/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := codeartsartifact.NewCodeArtsArtifactClient( codeartsartifact.CodeArtsArtifactClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListProjectRolePermissionsRequest{} response, err := client.ListProjectRolePermissions(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
OK |
错误码
请参见错误码。