Hi!
I use List Of Value with shuttle, to assign user roles.
I want to display roles hierarchically, for instance, when user who is logged in, has an Admin role this user should be able to see all roles and assignee them to selected user from LOV item. When user have Moderator role, then should be able to see users who are the moderators and all other who are below this role. And user should be unable to see roles above own role in shuttle.
Thanks in advance
Basically, you need the SQL query for LOV, and for this, I must know your table structures related to user and user roles master, etc.
For now, I assume your tables and columns and writing an example query below:
The above query is just an example, actually, you should assign the user type to an application item at the time of login.
Let me know if I understood it right and if I am right then you have to describe your table structures so that I can give you a better example.
Thanks for response Vinish!
For instance, I have roles: ADMIN, MODERATOR, EDITOR, READ_ONLY
Admin should be able to change roles for all users and can see all roles in shuttle and assign them to users.
Moderator should be able to see MODERATOR, EDITOR and READ ONLY users. And can assign all roles except ADMIN(this role should not be shown in the shuttle).
Here is example of my tables:
I have link tables for Roles and Privileges :
Follow these steps to make it easier:
Currently, as I can not see your data and the actual tables, I can give only this idea.
Thanks a lot Vinish!
I also filtered LOV item. When user who is logged in has MODERATOR role, that user can’t see admin users. 🙂
SELECT username, id
FROM users s1
LEFT JOIN User_roles s2 on s1.id = s2.fk_user_id
LEFT JOIN roles s3 on s2.fk_app_role_id = s3.role_id
WHERE
( EXISTS ( SELECT 1
FROM roles
WHERE :ADMIN = ‘ADMIN’
) ) OR
( name NOT LIKE ‘ADMIN’ );
That’s great 👍 Pavlos.