Updated on 2026-01-22 GMT+08:00

Viewing Role Permissions of a Project

Function

View role permissions of a project.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

codeartsartifact:releaseRepo:getProjectInfo

Read

-

-

-

-

URI

GET /devreposerver/v5/project-role/permissions

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

Project ID, which uniquely identifies a CodeArts Req project. The value is the same as that of project_id in the URL https://{host}/cloudartifact/project/{project_id}/repository on the list page of self-hosted repos.

Constraints:

String length: 32 characters.

Value range:

N/A

Default value:

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

status

String

Definition

Request status.

Range

success: The request is successful.

error: The request fails.

trace_id

String

Definition

Request ID, which uniquely identifies the current request.

Range

A string of digits and hyphens (-).

result

Array of ProjectRolePermissionDo objects

Definition

Permission list.

Range

N/A.

Table 3 ProjectRolePermissionDo

Parameter

Type

Description

id

String

Definition

id.

Range

N/A.

role_id

Integer

Definition

Role ID.

Range

N/A.

devuc_role_id

String

Definition

ID of the DevUC role.

Range

N/A.

project_id

String

Definition

Project ID.

Range

N/A.

is_permission_config

Boolean

Definition

Whether the user has the permission configuration permission.

Range

N/A.

is_change_pkg_status

Boolean

Definition

Whether the package status can be changed.

Range

N/A.

is_upload

Boolean

Definition

Whether the package can be uploaded.

Range

N/A.

is_delete_restore_test_pkg

Boolean

Definition

Whether the test package can be deleted and restored.

Range

N/A.

is_delete_restore_prod_pkg

Boolean

Definition

Whether the production package can be deleted and restored.

Range

N/A.

is_edit_test_pkg

Boolean

Definition

Whether the test package can be edited.

Range

N/A.

is_mkdir

Boolean

Definition

Whether a folder can be created.

Range

N/A.

is_download

Boolean

Definition

Whether the download can be performed.

Range

N/A.

is_restore_all

Boolean

Definition

Whether items in the recycle bin can be restored.

Range

N/A.

is_empty

Boolean

Definition

Empty or not.

Range

N/A.

create_time

Long

Definition

Creation time.

Range

N/A.

update_time

Long

Definition

Update time.

Range

N/A.

migrated_630

Integer

Definition

migrated_630.

Range

N/A.

region

String

Definition

Area.

Range

N/A.

user_id

String

Definition

User ID.

Range

N/A.

roles

String

Definition

Role.

Range

N/A.

Example Requests

View role permissions of a project.

https://{URL}/devreposerver/v5/project-role/permissions?project_id=f132b62084774001b84c294c0eef27f2

Example Responses

Status code: 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 Sample Code

The SDK sample code is as follows.

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)
    }
}

More

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.