I am developing a native app which has 2 groups of users: supplier and admin. I am able to assign roles to the screens such that only suppliers are able to view screens meant for them and likewise for admins. However, my app has a bottom bar block which is used to navigate users to different screens. Is it possible to assign roles for blocks as well?

Hi Jolene Kwek,

yes you can do it by using if condition, check role in if condition and but put you block as true and false area.

just like 

SyntaxEditor Code Snippet

CheckCHRole()


hope this will help you.


Regards

Rahul Sahu

Hi Jolene,

You cannot assign role to block as you do it for screens but you can control the visibility or rendering  of your web block using some inbuilt functions.

You can enclose your webblock in if condition checking for a specific role and if it matches the role than only it will be visible for the user . You can do this for links buttons or for any other control as well.

In mobile You cannot directly check the role like we do in web , here first you have to create a server side function containing the checkrole function and than create a client side function which will call the server side function and than use that client side function in your if condition.

Please try this and let me know if it solves your problem.


Regards,

-PJ-

Hi Rahul and Pramod, 

Thanks for the suggestions. I will be sure to try it. Anyways, I heard that another alternative might be to work on 2 different modules, one for suppliers and one for admins. But how do I merge the modules afterwards? Because when I test my app in browser, I am only testing one of the modules and not the application as a whole. 

Hi Jolene,

Even after having two different module you might have some menus defined in your application through which you can navigate to different screen in different module .

You don't need to merge the module , module are made for separation of concern and thus depends upon the features and functionality you can choose different modules like one for Supplier one for Customer etc. and the screens , block or logics can be shared or referred in other modules by making them public and adding reference in the other module.

Let me know if you have any doubt in this regards , i would be happy to talk about this.

Also for your reference i have created a simple oml to check role for a webblock , please refer this and see if it can be any help.

I have create a simple oml where i wrapped the check role function in a server side action and than called it on initialize and assign the return value in one variable and finally enclosed the block in if condition checking with this variable.


Regards,

-PJ-


Hi Jolene,

You can use OutSystems Javascript API to perform this check using checkIfCurrentUserHasRole function.

Check below link for more information

https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/JavaScript_API/Security

Pramod Jain wrote:

Hi Jolene,

Even after having two different module you might have some menus defined in your application through which you can navigate to different screen in different module .

You don't need to merge the module , module are made for separation of concern and thus depends upon the features and functionality you can choose different modules like one for Supplier one for Customer etc. and the screens , block or logics can be shared or referred in other modules by making them public and adding reference in the other module.

Let me know if you have any doubt in this regards , i would be happy to talk about this.

Also for your reference i have created a simple oml to check role for a webblock , please refer this and see if it can be any help.

I have create a simple oml where i wrapped the check role function in a server side action and than called it on initialize and assign the return value in one variable and finally enclosed the block in if condition checking with this variable.


Regards,

-PJ-


Hi PJ,

Thank you so much for your help. I will check out the oml. 


Nikhil Gaur wrote:

Hi Jolene,

You can use OutSystems Javascript API to perform this check using checkIfCurrentUserHasRole function.

Check below link for more information

https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/JavaScript_API/Security

Hi Nikhil, 

Alright thanks, I will check it out. 


Pramod Jain wrote:

Hi Jolene,

Even after having two different module you might have some menus defined in your application through which you can navigate to different screen in different module .

You don't need to merge the module , module are made for separation of concern and thus depends upon the features and functionality you can choose different modules like one for Supplier one for Customer etc. and the screens , block or logics can be shared or referred in other modules by making them public and adding reference in the other module.

Let me know if you have any doubt in this regards , i would be happy to talk about this.

Also for your reference i have created a simple oml to check role for a webblock , please refer this and see if it can be any help.

I have create a simple oml where i wrapped the check role function in a server side action and than called it on initialize and assign the return value in one variable and finally enclosed the block in if condition checking with this variable.


Regards,

-PJ-


Hi PJ,

I noticed you use the client side action under "OnInitialise" of the home screen. This will cause performance issues as prompted by service studios. Will this performance issue be significant and are there ways to solve it? 


Yes Service Studio shows this warning because this will be a server side call but i dont think this will make any big performance issue .

Anyways as the roles reside at server side you have to do something like this to check or you can also check the way Nikhil suggested .

Regards,

-PJ-