If statement to hide links based on role

Hello,  In older version I could hide links with the If condition.

I don't see the Check roles anymore.

how can I easily hide these links based on a "SuperUser" role I have made

Old way

NEW WAY. does not give me the "CheckSuperUserRole(UserId)

Rank: #86

Hello Dan,

Hope you're doing well.

It seems that you are working on a Reactive Web Application nowadays and you were working on a Traditional Web Application before.

In Traditional Web Applications everything is done Server Side, so you are able to call these Check<Role>Role functions directly in the screen.

In Reactive Web Applications, you have a Client vs Server concept. So you are not allowed to call these Check<Role>Role functions directly in the screen (Client Side) because they run Server Side.

What you can do in this scenario is to call this Check<Role>Role action inside an event of the screen/block, assign the result to a local variable and use that variable to control what you want to show in the screen.

Another alternative is to use JavaScript to check for the role directly in the Client Side (avoids a server call).

You just need to add a JavaScript tool in a Client Action and invoke the checkIfCurrentUserHasRole function as explained in here: https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/JavaScript_API/Security

Please be aware that Client Side Roles can easily be tampered using browser tools, so you should always validate Server Side if you are getting or storing data. Also, you shouldn't rely on this to enable access to sensitive information.

Please check these threads with some nice explanations that may help you:

Hope that this helps you!

Kind regards,

Rui Barradas