I have created a role based web application(Admin,User,SuperAdmin,Approver etc.).
Now currently i am checking role of logged in user and if user is not validated redirected to him/her on a screen with message "unauthorized".But i am doing this on every screen its not a standard way to do also code replicated on every screen.
Can i do it globally some where so that it will check role of user and then perform next action accrding to role
pradip chavhan wrote:
Hi
You can check the role while user is loging if he is not valid you can redirect to unauthorised screen and if he is valid you can redirect him to whichever screen you want and in every screen you can see in properties there is a option for role you can check that role, so the screen is accessible for that particular role .
Hi Paradip
OutSystems determines whether a user is authorized to access a page automatically assuming you have configured the roles allowed to access your pages in the Roles section of the Web Screen properties (see Shrinjala's screenshot).
If a user is trying to access a page without an allowed role, OutSystems will throw a Security Exception, which is handled in the Global Exception handler.
By default, all apps have an OnException handler (If you removed yours by accident, you can create one by right-clicking on an UI Flow and selecting Add an On Exception Action):
The OnException handler is set as the application's default Global Exception Handler (If it isn't set by default, click on your module name, the top-most node in the Interface tab, and select the OnException action as your global exception handler in the properties panel):
The OnException handler should contain a SecurityException flow which is triggered from all pages if an unauthorized user is trying to access a page:
If the user is logged in, the SecurityException flow redirects the user to the Invalid Permissions page (This can be changes to any page you want in this flow).
Ossama
Thanks ossama for more details.