Hello,
I would like to have a role that can only read all the different screens and have no permission to write/edit anything. I have read that read-only role does not exist in Outsystems and the way to go about it is to use the CheckRole function. However, I have over 20+ screens with many inputs, any suggestions on how to achieve what I want? Or do i have to manually go over every single screen and CheckRole? Thank you!
Hi Low,
Indeed there is no concept of a readonly role in OutSystems. You define as a developer the role and what permissions the role has. You have two options to solve this.
Regards,
Daniel
Hi Daniel,
Thank you for your explanation! It is unfortunate that there is no readonly role for outsystems. Both options that you mention to solve this issue will take a fair bit amount of time but I guess that is the only way for now. Thank you!
Hi Low, yes I fully agree. It would be a nice feature if Service Studio would provide a way to make inputs automatically readonly and links and buttons disabled/hidden based on a role.
You can submit an idea for this on www.outsystems.com/ideas
Hi,
Create a reusable server action that encapsulates the logic for checking the user's role with using the (CheckRole) function.
And call it in input, screens.
Hope this help's you
Thanks
Ruchi
Hi Nico,
I believe that you have to check that for each screen/ input. And you can use the solution provided by @Ruchi Dubey to define a reuseable function for checking that role, and remember to call that CheckRole function for any submit action before saving data to DB.
PS: One more way is to check the Role at the client site using this built-in JS function mentioned here for better performance: https://www.outsystems.com/forums/discussion/55602/how-to-check-role/ , AND REMEMBER to check role again before actually save data to DB.
Hi Low Nico,
Try to follow these steps-
- create a static entity, and add all roles in it and keep the same names as the roles are having.
- now take the dependencies from the system for Entity- Role, UserRole, Role- now create a server action and add Aggregate and apply these filters
and then you can put the output is true or not
now create an data action for each screen and use that server action.and you can use this data action on ready or on after fetch and if the action returns false the you send on another screen.
Thanks and regardsPrince