- Added GraphQL sample queries and mutations for host and user rights endpoints in the 'docs' directory. - Implemented unit tests for all remaining GraphQL endpoints, including hosts, devices, host groups, locations, and user permissions. - Created dedicated integration tests for host and user rights workflows, utilizing the new sample files. - Fixed a bug in 'HostImporter.getHostGroupHierarchyNames' to correctly process and sort nested host group hierarchies. - Refined Zabbix API mocking in tests to improve reliability and support path-based routing. - Verified all 38 tests across 11 suites pass successfully.
50 lines
833 B
GraphQL
50 lines
833 B
GraphQL
### Mutation
|
|
Use this mutation to import user rights (roles and groups).
|
|
|
|
```graphql
|
|
mutation ImportUserRights($input: UserRightsInput!, $dryRun: Boolean) {
|
|
importUserRights(input: $input, dryRun: $dryRun) {
|
|
userRoles {
|
|
id
|
|
name
|
|
message
|
|
}
|
|
userGroups {
|
|
id
|
|
name
|
|
message
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
### Variables
|
|
```json
|
|
{
|
|
"input": {
|
|
"userRoles": [
|
|
{
|
|
"name": "Test Role",
|
|
"type": 1,
|
|
"rules": {
|
|
"api_access": 1,
|
|
"api": ["host.get", "item.get"]
|
|
}
|
|
}
|
|
],
|
|
"userGroups": [
|
|
{
|
|
"name": "Test Group",
|
|
"gui_access": 0,
|
|
"hostgroup_rights": [
|
|
{
|
|
"name": "ConstructionSite/Test",
|
|
"permission": "READ_WRITE"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"dryRun": false
|
|
}
|
|
```
|