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

Querying Permissions of a Multi-Role User

Function

Query permissions of a multi-role user.

Calling Method

For details, see Calling APIs.

Authorization Information

No identity policy-based permission required for calling this API.

URI

GET /devreposerver/v5/user/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

ProjectRolePermissionDo object

Definition

Permission information.

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

Query permissions of a multi-role user.

https://{URL}/devreposerver/v5/user/permissions?project_id=f132b62084774001b84c294c0eef27f2

Example Responses

Status code: 200

OK

{
  "status" : "success",
  "trace_id" : "4933f7d81844450281d835f4ec7224d4",
  "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
  }
}

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 ShowMultiRolesUserPermissionsSolution {

    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();
        ShowMultiRolesUserPermissionsRequest request = new ShowMultiRolesUserPermissionsRequest();
        try {
            ShowMultiRolesUserPermissionsResponse response = client.showMultiRolesUserPermissions(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 = ShowMultiRolesUserPermissionsRequest()
        response = client.show_multi_roles_user_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.ShowMultiRolesUserPermissionsRequest{}
	response, err := client.ShowMultiRolesUserPermissions(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.