Difference between grant/revoke role and delete/create user role

Difference between grant/revoke role and delete/create user role

  

Hi all,


I am trying to do some work with creating and revoking roles.


I am trying to do it dynamically, using create/delete userrole server actions. However these don't seem to do the same thing as Grant/Revoke role actions.


For example, I have a link that should only be visible to a certain role, when I delete the userrole entry for my user for this role, the link is visible, however when I revoke the role the link disappears.

The delete action is working the role just seems to still be granted.

Any ideas?


Thanks,

James

James,

There's two types of things you are trying to do but you are mixing up the terminology.  Creating or deleting roles dynamically doesn't make sense since you would have no logic that would know what the new role was and what to do with it.  Roles should always be created or deleted in Service Studio.

What you want is, once you have created the roles in Service Studio (which in turn creates the GrantRole, RevokeRole and CheckRole actions), is to grant and revoke roles dynamically.  Then the logic that you have around the link (or anything else) will know, using the CheckRole action, whether the user should see the link or not.  If you go to the URL <your environment>/users you will see how Outsystems implements this.

Keep those two pairs of terms straight and it will be much easier to understand.

Hope this helps,

Curt


Solution

If you "delete" a role from a user then it will not take affect until the users session is recreated, ie the user logs out and logs back in again.


Solution