Function to check if user has permission on a screen based on screenid and userid
651
Views
4
Comments
New
Builtin & User functions

OutSystems should have a built in function available to check dynamically whether a user has access to a certain screen. This function could have a screen_id and a userid as input parameters and returns a boolean stating whether the user has access to the screen or not.

Hey Jimmy,

Are roles not sufficient enough to achieve this?
Though roles requires you to setup the required permissions on design time, I can understand you would like to have some more control over it afterwards.

You could build this yourself by using the ESPACE_SCREEN entity, however this is not a public entity so it requires you to use some cheats..... 

Hey Joey,

Long time no speak :). 

The issue here is not about setting up the screen permissions. That works fine, and I would like to do that during design time using the checkbox mechanism thats already in place.

The problem arises when you want to have a dynamic menu, created through a list/table with url attributes instead of hardcoded menuitems.

If you do that you wont be able to verify the user roles against the roles assigned to a certain screen in order to hide the menu items the user does not have permissions on. Because you cant get the permissions/roles related to a screen during runtime.

The idea is to create a built-in function to verify during runtime whether a user has access to the screen or not, so that I can use that logic in the rest of my code.

For some reference: https://www.outsystems.com/forums/discussion/48647/access-to-ossys-espace-screen-role/

Ah, I understand.

This in fact doesn't seem to be present in database, you might have to read the binary of the espace to get this information :( 

Your other choice is to create a mechanism yourself, but it would be very nice if there could be a function to get this information for generating menu's dynamically.

You got my vote.

Changed the category to
Builtin & User functions