filter users with roles

sieng
Kilo Contributor

Hi guys,

I would like to count the number of users with at least one role on table [sys_user]. How can I achieve that?

I filtered "roles is anything" and get no results at all.

I should at least get 10 users with role(s).

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Robbie
Kilo Patron
Kilo Patron

Hi Denis,


There is a table called 'User Roles' (sys_user_has_role) which shows all records where a user has a role / n-number of roles. Simply 'group by' on the User field to provide you with the info you require. (Number of users with role(s) assigned).



In the example below you can see there are 4894 records (where a user has a role - obviously a user can have more than one role which is included in the overall result set), however if I group by the user field, I can see I have 688 unique User records with the respective role(s).



Thanks, Robbie.



Please mark this question correct and helpful to help close out open questions on the community.



find_real_file.png


View solution in original post

4 REPLIES 4

karthiknagaramu
Kilo Sage

Hi,



I believe if the roles are provided through groups this filter might not work. You can directly open User Roles(under User Administration) and see all the users has roles grouped by each role.



Regards,


Karthik Nagaramu


Robbie
Kilo Patron
Kilo Patron

Hi Denis,


There is a table called 'User Roles' (sys_user_has_role) which shows all records where a user has a role / n-number of roles. Simply 'group by' on the User field to provide you with the info you require. (Number of users with role(s) assigned).



In the example below you can see there are 4894 records (where a user has a role - obviously a user can have more than one role which is included in the overall result set), however if I group by the user field, I can see I have 688 unique User records with the respective role(s).



Thanks, Robbie.



Please mark this question correct and helpful to help close out open questions on the community.



find_real_file.png


sieng
Kilo Contributor

Thank you Karthik and Robbie.


Your idea works perfectly Robbie. I have marked your answer as correct, right?


Robbie
Kilo Patron
Kilo Patron

Hi Denis, You haven't marked my post correct yet unfortunately, or not what I can see?


Please open your post via this link(filter users with roles ) and click Correct. Thanks Denis - appreciate it and glad to help.



Thanks,


Robbie