Hi team,

I am creating reactive web app, there are certain links which I want to hide for certain roles. How should I do that in if condition? For example if I want to check if the role is doctor how should it go?


Regards,

Sahil

Hi Sahil,


you may use the output "HasRole" of the CheckRole action for that Role. Then you can do whatever you like.


Now, if you want to Hide links from a menu, check the role in the preparationevent of the screen and set a Boolean Screen variable like "IsDoctor" to its correspondant value. Then Enclose your Links in an If-Statement checking the "IsDoctor" value.

Solution

@carlos, what you suggest hat will only work server side, or for traditional webbapps not for reactive web apps.

@Sahik, use the OutSystems JavaScript API to perform client side role vakidstions, add a JavaScript tool in a client action and invoke the checkIfCurrentUserHasRole function, see the Documentation for syntax.

PS be aware client side validation van be tampered by accessing browser tools. Always build in server side vakidstions when updating or accessing data too.

Regards,

Daniek

Solution

Daniël Kuhlmann wrote:

@carlos, what you suggest hat will only work server side, or for traditional webbapps not for reactive web apps.

@Sahik, use the OutSystems JavaScript API to perform client side role vakidstions, add a JavaScript tool in a client action and invoke the checkIfCurrentUserHasRole function, see the Documentation for syntax.

PS be aware client side validation van be tampered by accessing browser tools. Always build in server side vakidstions when updating or accessing data too.

Regards,

Daniek

 @daniel That's right :) , and as you metioned, the server side validation, in any kind of app, must be taken into account.

regards.

 

Thank you both of you :)