10
Views
4
Comments
Solved
How is User_Effective_Role updated if I programmatically assign a User to a Group?
Question

How is User_Effective_Role updated if I programmatically assign a User to a Group in Group_User?

I need to programmatically assign a Role Group to a User and this I do by inserting the User and Group into Group_User. How will User_Effective_Role be update with the new roles in the group assigned to the user? Do I need to do this manually (programmatically) or is there a trigger or timer in OutSystems backend that will do this automatically?

And what if the Group is revoked from the user; i.e. then I delete it from Group_User, will the User_Effective_Role  be consolidated from the remaining user roles & groups assigned to the user by OutSystems or must I do this manually?

It seems there is no proper API for Group management or documentation on this mechanism.

Rank: #127
Solution

Hi Elize,

i think User_Effective_Role is not a table but a view.  

So your updates on Use_Role (both inserts and deletes) should immediately be visible in User_Effective_Role.

Why do you ask, have you noticed any inconsistencies ?

Dorine

Thanks Dorine, yes that would make sense, I did not think of considering it to be a view.

Ha, ha, I am so lazy, I should have read the description on  the User_effective_Role, it states it is a view:

"Read-only view containing user specific roles (either direct or via user groups)."

Rank: #245

Small addition:

Assigning the roles will only take effect after user has logged in again, when they are persistent.


So the view will show the role assigned, but the user might not have permission and has to log off and back in again.