While we don't have the ability to track/search users in groups in the UI, we do have some advice to give on using the API to grab at least some of this information, which might be helpful. You may want to use a tool such as Postman to help manage requests from the API.
You can create a new GET request using the call: /api/v1/groups?roles.value={{userId}}. That will return you the groups that the user is assigned to, although it won't be a clean separation on the roles. Some additional processing will need to be done to retrieve the roles that the user is assigned to for each group result that comes back.
Using a second call: /api/v1/users/{{userId}}/ancestral-group-and-role-ids, you can then retrieve the groups with associated roles - but it may contain additional groups.
For example, if you have a user within a hierarchy structure like this:
Kuali University (id: 3)
└── College of Fine Arts (id: 2)
└── Music Department (id: 1)
Faculty: User
And the user is assigned to the role of "Faculty" within the Music department, then this call will return the id for the Music department (id: 3) in addition to the Groups in its ancestry. In this example, this would include the College of Fine Arts (id: 2) and Kuali University (id: 1). These items will be shown only by their id and will not include the label for the group:
{
"groups": [
"57572732bf3a03bf6867a2ea",
"5720f1707fa03a2d341e58bd",
"5720f1707fa03a2d341e58b2"
],
To illustrate the relationship between the id and group -
- 57572732bf3a03bf6867a2ea = id: 1 - Music Department
- 5720f1707fa03a2d341e58bd = id: 2 - College of Fine Arts
- 5720f1707fa03a2d341e58b2 = id: 3 - Kuali University
The roles listed, however, will only be the roles that the user is explicitly assigned to. So in the above example, the response would look like this:
{
"groups": [
"57572732bf3a03bf6867a2ea",
"5720f1707fa03a2d341e58bd",
"5720f1707fa03a2d341e58b2"
],
"roles": [
"57572732bf3a03bf6867a2ea:x-OMpl-os"
]
Under the heading for roles, it will be listed as the group id (id: 1, referring to the Music Department) followed by the id for the role.
While this call will return the information, it may not be in the easiest to read format. From here, you can use a tool such as a JSON to CSV converter to place this data into a spreadsheet -
From in the spreadsheet, you could then use the Find and Replace tools to replace the ids with the associated group or role in order for it to be easily read.
If you aren't sure which group goes with each ID, you can make a call to get that information using: /api/v1/groups/{{groupid}}?fields=name,id
For example, looking up 57572732bf3a03bf6867a2ea = id: 1 from the previous example using api/v1/groups/57572732bf3a03bf6867a2ea?fields=name,id returns
{
"name": "Music",
"id": "57572732bf3a03bf6867a2ea"
}
If you aren't sure what the role is, you can look up the category for the group to see the names of the roles. For example, if 'Music' was the group, and the category was 'Department', then you would need to look up the category. You can get the id for the category by adding categoryId to the end of the previous string - api/v1/groups/57572732bf3a03bf6867a2ea?fields=name,id,categoryid to retrieve the id for the department category:
{
"name": "Music",
"id": "57572732bf3a03bf6867a2ea",
"categoryId": "cd053ca9-e96e-49c7-80b2-e59049cd0950"
}
Next, if you take the category ID - you can make a call like this: /api/v1/categories/cd053ca9-e96e-49c7-80b2-e59049cd0950?fields=roleSchemas. This call will return the following, which includes the name of the role:
{
"roleSchemas": [
{
"description": "",
"id": "x-OMpl-os",
"name": "Faculty",
"productSlug": ""
}
]
}
Comments
0 comments
Please sign in to leave a comment.