Find Users with a Role
We have custom Role Base Access Control (RBAC). I am able to find a specific role by using session.getAdminInstance().getNode(NodeConstants.NODE_ROLES) and performing getChildNode(“RoleName”). This gives me an IRole.
How do I then find all of the users under this role? It seems like a two fold issue, as I want all the Roles either directly on the User, or via a UserGroup membership. It appears the Administrator UI is able to easily obtain this information when you load a Role there is a Users and UserGroups tab. I am crossing my fingers that this information is somehow exposed through the common API.
Not sure if you can get the list of users/user-groups directly from the (ITree) IRole object, but as a workaround, once you have the name of the role, you could easily create two queries (1 for Users and 1 for User groups) who have that role listed in “General Info.Roles” . For the User Group query, you would have to iterate through the results to get the user group object, and then its respective user table to display each user…