User Roles - See list of users assigned to roles

Hi

Is there a way to find all the users assigned to specific roles? I understand you can select a user and see the roles they are assigned to, but I would also like to be able to select a role and see the users assigned to that.

We use the roles extensively for access rights throughout the system and utilize the multiple role hierarchy process to control basic rights then add additional roles to vary users access depending on the requirements. This works really well.

However, as our system is continually being developed we therefore have new elements of the system and these are not always going to be available by default to all users or even an existing role in its entirety, but might be relevant for some users under a specific role. In this case it would be really useful to select a role and see the users associated so that we can then add the additional role to the hierarchy for the required users.

Thanks
David

Hi,
You can invoke a JPQL query.
Relation between User and Role is stored in the com.haulmont.cuba.security.entity.UserRole (sec$UserRole) entity.
Note that if the role is a design-time one - then UserRole#role attribute will be null.
While UserRole#roleName is always filled with the role name.

1 Like

@albudarov Thanks