permission management API definition
Download OpenAPI specification:Download
Provide functionality for adding, modifying, and deleting menus, permissions, and roles
Add roles in batches
- name、code required.
- The number of new batches is limited to 50.
- Character numbering rules: letters, numbers or underscores and their combinations, no more than 50 characters.
- Character name cannot exceed 50 characters.
- Role description cannot exceed 255 characters.
- Role code cannot be repeated or already exists。
- If the verification fails or is abnormal, all new additions will fail.
Request Body schema: application/json
code required | string <= 50 characters role code |
name required | string <= 50 characters role name |
description | string <= 255 characters role description |
Responses
Request samples
- Payload
[- {
- "code": "systemRole",
- "name": "admin role",
- "description": "admin user"
}
]
Response samples
- 400
- 500
{- "code": 100105000,
- "message": "Required parameters cannot be empty!"
}
Modify roles in batches
- name、code required.
- The number of batch edits is limited to 50.
- Character numbering rules: letters, numbers or underscores and their combinations, no more than 50 characters.
- Character name cannot exceed 50 characters.
- Role description cannot exceed 255 characters.
- Role encoding must exist.
- If the verification fails or is abnormal, all modifications will fail.
Request Body schema: application/json
code required | string <= 50 characters role code |
name required | string <= 50 characters role name |
description | string <= 255 characters role description |
Responses
Request samples
- Payload
[- {
- "code": "systemRole",
- "name": "admin role",
- "description": "admin user"
}
]
Response samples
- 400
- 500
{- "code": 100105000,
- "message": "Required parameters cannot be empty!"
}
query role
Query role list data.
- Only supports querying the role data of a certain company
- When the company code does not exist, the returned data is an empty collection
- Support pagination query
- Support fuzzy query according to role code (roleCode), role name (roleName), role description (description)
- Support query based on role creation time and update time
- Support for querying deleted roles
query Parameters
keyword | string <= 50 characters Example: keyword=systemRole Keyword, supports fuzzy query according to role code (roleCode), role name (roleName), and role description (description).
|
companyCode required | string <= 50 characters Example: companyCode=default_org_company company code |
includeDeleted | boolean Default: false Example: includeDeleted=true Whether to query for deleted roles
|
createTimeRange | string <= 60 characters Example: createTimeRange=[2022-11-29T00:00:00.000+0000,2022-11-30T00:00:00.000+0000) Role creation time query range;
The time format is (the time format must include a time zone): "yyyy-MM-dd'T'HH:mm:ss.SSSZ".
|
modifyTimeRange | string <= 60 characters Example: modifyTimeRange=[2022-11-29T00:00:00.000+0000,2022-11-30T00:00:00.000+0000) Role update time query scope;
The time format is (the time format must include a time zone): "yyyy-MM-dd'T'HH:mm:ss.SSSZ".
|
pageSize | integer [ 1 .. 500 ] Default: 20 Example: pageSize=20 Number of records per page. |
current | integer Default: 1 Example: current=1 The current page number, starting from 1. When not passed in, the default value is 1. |
header Parameters
Accept-Language | string <= 8 characters Example: zh-cn Internationalized language (depending on the language, the system encoding value returns content in different languages), the default is the language of the server operating system. English is en-us, Chinese is zh-cn. |
Responses
Response samples
- 200
- 400
- 500
{- "list": [
- {
- "roleCode": "systemRole",
- "roleName": "admin role",
- "description": "Roles assigned to normal users",
- "createTime": "2022-11-29T16:02:15.666+0000",
- "modifyTime": "2022-11-29T16:02:15.666+0000",
- "valid": 1
}
], - "pagination": {
- "total": 100,
- "pageSize": 20,
- "current": 1
}
}
Batch delete roles
- The number of deleted characters is limited to 50.
- Do not omit when deleting a role that does not exist.
- The roles associated with positions and users cannot be deleted.
- Support idempotent operations.
- When the verification fails or is abnormal, all deletions will fail.
path Parameters
roleCodes required | string Delete roles in batches through role codes, multiple role codes are connected by "," |
Responses
Response samples
- 500
{- "code": 100000001,
- "message": "Unknown exception occurred in the system"
}
Save resource collections in batches
Used to add and modify resource collections. Added resource collection, save code, name, link address and company. Modify the resource collection, support to modify the resource collection name and link address.
Notice:
- Make a unique identifier according to the resource collection code, if it does not exist, add it, if it exists, modify it; a request can be added and modified at the same time.
- It is not supported to modify the resource collection code resCollectionCode and company code companyCode when modifying.
- A request supports up to 20 pieces of data.
- All resource collections in a request, either all of them are saved successfully, or all of them fail to be saved, and there will be no partial success
Request Body schema: application/json
companyCode | string <= 20 characters The code of the company to which the resource collection belongs, and the passed parameter is filled with the default company code "default_org_company" for the space-time system |
resCollectionCode required | string <= 200 characters Resource collection encoding, only letters and numbers are supported
|
resCollectionName | string <= 200 characters Resource collection name, required when adding |
resCollectionDataQueryUrl | string <= 500 characters Call back the app to query the resource information address, and refer to Callbacks for detailed interface definitions |
Responses
Callbacks
Request samples
- Payload
[- {
- "companyCode": "default_org_company",
- "resCollectionCode": "170d1e0dc2fd76604461b435c4b6d111000001",
- "resCollectionName": "factory model resource collection",
- "resCollectionDataQueryUrl": "192.168.12.1:8080/app/resourceCollectionA"
}
]
Response samples
- 200
- 400
- 500
{- "code": 100000000,
- "message": "operation succeeded"
}
Delete resource collections in batches
Used to delete resource collections.
Notice:
- Resource collection encodings that do not exist are ignored.
- The maximum number of deletions: 20
- The minimum number of deletions: 1
- For all resource collections in a request, either all deletions are successful, or all deletions fail, and there will be no partial success
- Support idempotence
path Parameters
resourceCollectionCodes required | Array of strings [ 1 .. 20 ] items [ items <= 200 characters ] Example: 1a7c29a037c411ed8087020017000b7b,3b6692ae37c411ed9381020017000b7b resource collection encoding collection |
Responses
Response samples
- 200
- 400
- 500
{- "code": 100000000,
- "message": "operation succeeded"
}
User resource permission query interface
Query the resource permissions assigned by the user (and the associated role) under the resource collection.
path Parameters
resourceCollectionCode required | string <= 200 characters Example: 3b6692ae37c411ed9381020017000b7b resource collection encoding |
query Parameters
userName required | string <= 32 characters Example: userName=admin123 username |
companyCode | string <= 20 characters Example: companyCode=default_org_company Company code, the passed parameter is filled with the default company code "default_org_company" for the space-time system |
keyCode | string <= 200 characters Example: keyCode=keyCode123 Resource key, if it is empty, return the resource collection and combine all authorized resources |
resType | string <= 200 characters Example: resType=tag_1 Resource type, used to filter resource permissions. If this parameter is passed, the resource permissions will be filtered according to the incoming parameters (this field is obtained from the returned data body of the third party through the query of resCollectionDataQueryUrl by the platform). If this parameter is not passed, all resource permissions under this resource collection will be queried. |
pageSize required | integer <= 500 Example: pageSize=500 The number of data items per page, the maximum number is 500; the recommended value is 500 to reduce the calling frequency |
current required | integer Default: 1 Example: current=1 current page number, starting from 1 |
header Parameters
Accept-Language | string <= 8 characters Example: zh-cn Internationalized language (depending on the language, the system encoding value returns content in different languages), the default is the language of the server operating system. English is en-us, Chinese is zh-cn. |
Responses
Response samples
- 200
- 400
- 500
{- "list": [
- "keyCode1",
- "keyCode2"
], - "pagination": {
- "total": 1,
- "current": 1,
- "pageSize": 500
}
}
Role resource permission query interface
Query the resource permissions assigned by the role under the resource collection.
path Parameters
resourceCollectionCode required | string <= 200 characters Example: 3b6692ae37c411ed9381020017000b7b resource collection encoding |
query Parameters
roleCode required | string <= 50 characters Example: roleCode=managerCode1 role code |
keyCode | string <= 200 characters Example: keyCode=keyCode123 Resource key, if it is empty, all authorized resources under the resource collection will be returned |
resType | string <= 200 characters Example: resType=tag_1 Resource type, used to filter resource permissions. If this parameter is passed, the resource permission will be filtered according to the incoming parameter (this field is obtained from the returned data body of the third-party query by the platform through resCollectionDataQueryUrl. For details of the third-party interface, see the batch save resource collection interface). If this parameter is not passed, all resource permissions under this resource collection will be queried。 |
pageSize required | integer <= 500 Example: pageSize=500 The number of data items per page, the maximum number is 500; the recommended value is 500 to reduce the calling frequency |
current required | integer Default: 1 Example: current=1 current page number, starting from 1 |
header Parameters
Accept-Language | string <= 8 characters Example: zh-cn Internationalized language (depending on the language, the system encoding value returns content in different languages), the default is the language of the server operating system. English is en-us, Chinese is zh-cn. |
Responses
Response samples
- 200
- 400
- 500
{- "list": [
- "keyCode1",
- "keyCode2"
], - "pagination": {
- "total": 1,
- "current": 1,
- "pageSize": 500
}
}
Query role interface based on resource permissions
Query all roles that have permissions for this resource.
path Parameters
resourceCollectionCode required | string <= 200 characters Example: 1a7c29a037c411ed8087020017000b7b resource collection encoding |
keyCode required | string <= 200 characters Example: keyCode123 resource key |
header Parameters
Accept-Language | string <= 8 characters Example: zh-cn Internationalized language (depending on the language, the system encoding value returns content in different languages), the default is the language of the server operating system. English is en-us, Chinese is zh-cn. |
Responses
Response samples
- 200
- 400
- 500
{- "code": 100000000,
- "message": "search successful",
- "list": [
- {
- "roleName": "roleName1",
- "roleCode": "roleCode1"
}, - {
- "roleName": "roleName2",
- "roleCode": "roleCode2"
}
]
}
Query user menu permissions and resource permissions
Query user menu permissions and resource permissions.
If the amount of returned data is too large, there may be performance problems. It is recommended that the total number of user menu permissions and resource permissions to be queried should not exceed 1000.
The returned result data is 0 in the following cases:
- Username does not exist
- Company code does not exist
- User does not belong to current company
query Parameters
username required | string <= 32 characters Example: username=admin123 Username, required |
companyCode | string <= 50 characters Example: companyCode=default_org_company Company code, optional |
header Parameters
Accept-Language | string <= 8 characters Internationalized language (depending on the language, return content in different languages), the default is the language of the server operating system, en_us for English, zh_cn for Chinese |
Responses
Response samples
- 200
- 400
- 500
{- "username": "userA",
- "menuPermissions": [
- {
- "menuName": "menu A",
- "menuCode": "menuCodeA",
- "url": "route/xxx/xxx",
- "menuOpPermissions": [
- {
- "menuOpName": "menu operation A",
- "menuOpCode": "opCode",
- "url": "route/operate/xxx/xxx"
}
]
}
], - "resCollectionPermissions": [
- {
- "resourceCollectionCode": "resService1",
- "resPermissions": [
- "reskey1"
]
}
]
}
Query role menu permissions and resource permissions
Query role menu permissions and resource permissions.
If the amount of returned data is too large, there may be performance problems. It is recommended that the total number of role menu permissions and resource permissions to be queried should not exceed 1000.
When the role code does not exist, the returned result data is 0.
query Parameters
roleCode required | string <= 50 characters Example: roleCode=roleCode1 role code |
header Parameters
Accept-Language | string <= 8 characters Internationalized language (depending on the language, return content in different languages), the default is the language of the server operating system, en_us for English, zh_cn for Chinese |
Responses
Response samples
- 200
- 400
- 500
{- "roleCode": "roleCodeA",
- "menuPermissions": [
- {
- "menuName": "menu A",
- "menuCode": "menuCodeA",
- "url": "route/xxx/xxx",
- "menuOpPermissions": [
- {
- "menuOpName": "menu operation A",
- "menuOpCode": "opCode",
- "url": "route/operate/xxx/xxx"
}
]
}
], - "resCollectionPermissions": [
- {
- "resourceCollectionCode": "resService1",
- "resPermissions": [
- "reskey1"
]
}
]
}