- Development Integration
- /
- SDK
- /
- Java
- /
Management module
- /
Manage data resources and permissions
- /
- Get User Permission List
¶ Get user permission list
This document is automatically generated based on https://github.com/authing/authing-docs-factory based on https://api-explorer.genauth.ai V3 API, and is consistent with API parameters and return results. If the document description is incorrect, please refer to V3 API.
¶ Description
This interface is used to query the permission data of certain users in certain permission spaces.
Our authentication interface has multiple authentication scenarios, the difference lies in the parameter list that can be passed in the scenario and the different forms of output parameters. When you need to query all permissions of certain users, you can use this interface,
¶ Note
The interface provides two array-type input parameters userIds and namespaceCodes to support batch query (note: namespaceCodes is optional).
¶ Scenario Example
If your business scenario is that after a user logs in, he can see all the documents, personnel information, equipment information and other resources that he can access or perform other operations on, then you can call this interface to query all the user's permissions after the user logs in.
¶ Request Example
¶ Query a single user permission list example
Note: In the return parameters of this interface, the tree type data resource permissions are returned in the path way
- Entry
{
"userIds": ["6301ceaxxxxxxxxxxx27478"]
}
- Parameters
{
"statusCode": 200,
"message": "Operation successful",
"apiCode": 20001,
"data": {
"userPermissionList": [
{
"userId": "6301ceaxxxxxxxxxxx27478",
"namespaceCode": "examplePermissionNamespace",
"resourceList": [
{
"resourceCode": "strCode",
"resourceType": "STRING",
"strAuthorize": {
"value": "Example string resource",
"actions": ["read", "post", "get", "write"]
}
},
{
"resourceCode": "arrayCode",
"resourceType": "ARRAY",
"arrAuthorize": {
"values": [
"Example array resource 1",
"Example array resource 2"
],
"actions": ["read", "post", "get", "write"]
}
},
{
"resourceCode": "treeCode",
"resourceType": "TREE",
"treeAuthorize": {
"authList": [
{
"nodePath": "/treeChildrenCode/treeChildrenCode1",
"nodeActions": ["read", "get"],
"nodeName": "treeChildrenName1",
"nodeValue": "treeChildrenValue1",
"nodeExtendFieldValue": {
"str": "str_value"
}
},
{
"nodePath": "/treeChildrenCode/treeChildrenCode2",
"nodeActions": ["read", "get"],
"nodeName": "treeChildrenName2",
"nodeValue": "treeChildrenValue2"
},
{
"nodePath": "/treeChildrenCode/treeChildrenCode3",
"nodeActions": ["read"],
"nodeName": "treeChildrenName3",
"nodeValue": "treeChildrenValue3"
}
]
}
}
]
}
]
}
}
¶ Example of querying multiple user permission lists
- Entry
{
"userIds": ["6301ceaxxxxxxxxxxx27478", "6121ceaxxxxxxxxxxx27312"]
}
- Parameters
{
"statusCode": 200,
"message": "Operation successful",
"apiCode": 20001,
"data": {
"userPermissionList": [
{
"userId": "6301ceaxxxxxxxxxxx27478",
"namespaceCode": "examplePermissionNamespace1",
"resourceList": [
{
"resourceCode": "strCode",
"resourceType": "STRING",
"strAuthorize": {
"value": "Example string resource",
"actions": ["read", "post", "get", "write"]
}
}
]
},
{
"userId": "6121ceaxxxxxxxxxxx27312",
"namespaceCode": "examplePermissionNamespace2",
"resourceList": [
{
"resourceCode": "arrayCode",
"resourceType": "ARRAY",
"arrAuthorize": {
"values": [
"Example array resource 1",
"Example array resource 2"
],
"actions": ["read", "post", "get", "write"]
}
}
]
}
]
}
}
¶ Example of querying the permission list of multiple users in multiple permission spaces
- Entry
{
"userIds": ["6301ceaxxxxxxxxxxx27478", "6121ceaxxxxxxxxxxx27312"],
"namespaceCodes": [
"examplePermissionNamespace1",
"examplePermissionNamespace2"
]
}
- Parameters
{
"statusCode": 200,
"message": "Operation successful",
"apiCode": 20001,
"data": {
"userPermissionList": [
{
"userId": "6301ceaxxxxxxxxxxx27478",
"namespaceCode": "examplePermissionNamespace1",
"resourceList": [
{
"resourceCode": "strCode1",
"resourceType": "STRING",
"strAuthorize": {
"value": "Example string resource",
"actions": ["read", "post", "get", "write"]
}
}
]
},
{
"userId": "6121ceaxxxxxxxxxxx27312",
"namespaceCode": "examplePermissionNamespace2",
"resourceList": [
{
"resourceCode": "arrayCode",
"resourceType": "ARRAY",
"arrAuthorize": {
"values": [
"Example array resource 1",
"Example array resource 2"
],
"actions": ["read", "post", "get", "write"]
}
}
]
}
]
}
}
¶ Method Name
ManagementClient.getUserPermissionList
¶ Request Parameters
| Name | Type | Is it required | Default Value | Description | Example Value |
|---|---|---|---|---|---|
| userIds | string[] | yes | - | User id list | ["6301ceaxxxxxxxxxxx27478"] |
| namespaceCodes | string[] | no | - | Permission Space Code List | ["examplePermissionNamespace1"] |
¶ Sample Code
package test.management;
import cn.authing.sdk.java.client.ManagementClient;
import cn.authing.sdk.java.dto.GetUserPermissionListDto;
import cn.authing.sdk.java.dto.GetUserPermissionListRespDto;
import cn.authing.sdk.java.model.ManagementClientOptions;
import cn.authing.sdk.java.util.JsonUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class GetUserPermissionListTest {
// Need to be replaced with your GenAuth Access Key ID
private static final String ACCESS_KEY_ID = "AUTHING_ACCESS_KEY_ID";
// Need to be replaced with your GenAuth Access Key Secret
private static final String ACCESS_KEY_SECRET = "AUTHING_ACCESS_KEY_SECRET";
public static void main(String[] args) throws Throwable {
ManagementClientOptions clientOptions = new ManagementClientOptions();
clientOptions.setAccessKeyId(ACCESS_KEY_ID);
clientOptions.setAccessKeySecret(ACCESS_KEY_SECRET);
// If you are a private deployment customer, you need to set the GenAuth service domain name
// clientOptions.setHost("https://api.your-authing-service.com");
ManagementClient client = new ManagementClient(clientOptions);
GetUserPermissionListDto request = new GetUserPermissionListDto();
List<String> userIds = new ArrayList<>();
userIds.add("6301ceaxxxxxxxxxxx27478");
userIds.add("6121ceaxxxxxxxxxxx27312");
request.setUserIds(userIds);
List<String> namespaceCodes = new ArrayList<>();
namespaceCodes.add("examplePermissionNamespace1");
namespaceCodes.add("examplePermissionNamespace2");
request.setNamespaceCodes(namespaceCodes);
GetUserPermissionListRespDto response = client.getUserPermissionList(request);
System.out.println(JsonUtils.serialize(response));
}
}
¶ Request Response
Type: GetUserPermissionListRespDto
| Name | Type | Description |
|---|---|---|
| statusCode | number | Business status code. You can use this status code to determine whether the operation is successful. 200 means success. |
| message | string | Description |
| apiCode | number | Segment error code, through which the specific error type can be obtained (not returned for successful requests). For a detailed list of error codes, see:API Code List (opens new window) |
| data | GetUserPermissionListDataDto | Response data |
Example Results:
{
"statusCode": 200,
"message": "Operation successful",
"apiCode": 20001,
"data": {
"userPermissionList": {
"userId": "6301cexxxxxxxxxxxxxxxxx78",
"namespaceCode": "examplePermissionNamespace",
"resourceList": {
"resourceCode": "resourceCode",
"resourceType": "STRING",
"strAuthorize": {
"value": "Example string resource Value",
"actions": "[\"read\",\"get\"]"
},
"arrAuthorize": {
"values": "[\"value0\",\"value1\"]",
"actions": "[\"read\",\"get\"]"
},
"treeAuthorize": {
"authList": {
"nodePath": "/treeCode1/treeCode11",
"nodeName": "Example Tree Resource Node Name",
"nodeActions": "[\"read\",\"get\"]",
"nodeValue": "Example Tree Resource Node Value"
}
}
}
}
}
}
¶ Data Structure
¶ GetUserPermissionListDataDto
| Name | Type | Is it required | Description | Example Value |
|---|---|---|---|---|
| userPermissionList | array | yes | User permission list Nested Type: UserPermissionListDto. |
¶ UserPermissionListDto
| Name | Type | Is it required | Description | Example Value |
|---|---|---|---|---|
| userId | string | yes | User ID authorized by data policy | 6301cexxxxxxxxxxxxxxxxx78 |
| namespaceCode | string | yes | Permission space Code authorized by data policy | examplePermissionNamespace |
| resourceList | array | No | List of all data policy resources of the user under the permission space Nested Type: OpenResource. |
¶ OpenResource
| Name | Type | Is it required | Description | Example Value |
|---|---|---|---|---|
| resourceCode | string | yes | Data resource Code authorized under data policy | resourceCode |
| resourceType | string | yes | Data resource type authorized under data policy. Currently, it supports three types: tree structure (TREE), string (STRING), and array (ARRAY). Different structures are returned according to different types. - STRING: string type result StrAuthorize- ARRAY: array type ArrayAuthorize- TREE: tree type TreeAuthorize | TREE |
| strAuthorize | No | String resource of data policy Nested Type: StrAuthorize. | ||
| arrAuthorize | No | Array resource of data policy Nested Type: ArrayAuthorize. | ||
| treeAuthorize | No | Tree resource of data policy Nested Type:TreeAuthorize。 |
¶ StrAuthorize
| Name | Type | Is it required | Description | Example Value |
|---|---|---|---|---|
| value | string | yes | String resource Value | Example string resource Value |
| actions | array | yes | String resource operation list | ["read","get"] |
¶ ArrayAuthorize
| Name | Type | Is it required | Description | Example Value |
|---|---|---|---|---|
| values | array | yes | Array resource Value list | ["value0","value1"] |
| actions | array | yes | Array resource operation list | ["read","get"] |
¶ TreeAuthorize
| Name | Type | Is it required | Description | Example Value |
|---|---|---|---|---|
| authList | array | yes | Tree resource authorization list Nested Type: TreeAuthBo. |
¶ TreeAuthBo
| Name | Type | Is it required | Description | Example Value |
|---|---|---|---|---|
| nodePath | string | yes | Tree resource node path | /treeCode1/treeCode11 |
| nodeName | string | yes | Tree resource node Name | Example tree resource node Name |
| nodeActions | array | yes | Tree resource node operation permission list | ["read","get"] |
| nodeValue | string | No | Tree resource node Value | Example tree resource node Value |
| nodeExtendFieldValue | map | No | Extended field value | {"str":"str_value"} |
