71
Views
6
Comments
Solved
User management screen needs a role management system.

I'm trying to make a role management system inside my user management screen.

I have already implemented most of the work. The only problem I have right now is to give the proper visual checkbox role to that user.

I have a list of my users, I have added a list of the roles of that espace to my userlist.

I do need to somehow link the roles of that user with that checkbox. I'm kinda lost with that. 

Idea is to grant/revoke that role for the user.


2024-12-10 04-40-04
Gitansh Anand
Solution

Move the filter where User Id from User_Effective_Role equals GetUserId() to the join condition instead of having it seperately in the filters tab.

2026-03-04 12-08-39
Luiz Henrique Stanqueviski

Hi Kadir,

If I understood correctly what you want to do, the best scenario would be to create an action to receive the User Id, the role and (True or False) if you want to add or remove the role of that user.

Then create a link in the checkboxes linked to this action.

Hope this helps.

2024-12-10 04-40-04
Gitansh Anand

Hi @Kadir Aksu, inside the aggregate which you are using to get roles, add one more source User_Effective_Role using a with or without join, condition for the join will be based on Role Id of both sources, then add a new filter where User Id from User_Effective_Role equals GetUserId(), then add a calculated attribute in the aggregate call it IsSelected and set it's default value to User_Effective_Role.Role_Id <> NullIdentifier(). uses this new calculated attribute as the variable of your check box.

Thanks
Gitansh Anand

UserImage.jpg
Kadir Aksu

Thank you, I feel like I have come closer to what I want to realize, however it's still not exactly what I'm looking for.


So I have a list of users.

Each user will have a list of all rolekd in that espace (Currently it's Admin and Team). With a checkbox left to it, this checkbox when checked will grant that user this Role, it will also revoke this Role of that user if it's unchecked. 

Also it should be checked if that user already has that Role and vice versa. I feel like your solution is good if I had 1 user. 

2024-12-10 04-40-04
Gitansh Anand

Hi, you can still use my logic; just move the check box UI and the aggregate to get the roles into a block along with the required logic. Add an input parameter for UserId to the block, and replace GetUserId() with input UserId in the filter inside the aggregate. Then use this block in place of checkbox UI and pass the current UserId of the list.

Thanks
Gitansh Anand

UserImage.jpg
Kadir Aksu

Yes it almost works, however I only see the roles if that User has that role, if that user does not have that role, it does not show it. 


A user with those roles does have the list, but the idea should be that it should show even if that user does not have that role. So we cant grant that user that role if we want to. Somehow it doesn't show this role.


2024-12-10 04-40-04
Gitansh Anand
Solution

Move the filter where User Id from User_Effective_Role equals GetUserId() to the join condition instead of having it seperately in the filters tab.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.