How to make a common menu only visible to admin user?

Hi, I'm new to Outsystems platform, I need to have a common top-menu web block visible only to the admin user.

I have an admin role and an admin user. I can go to a screen and enclose the web block into an "if" and check for the admin-role. But do I have to do that in every single screen were the menu appears? or how can I make it so that it is automatically checked in every screen that includes the top-menu?

Thanks a lot!

Hello Ulises, you have to perform that validation on the web block and not on every screen. If you put the if inside the web block and perform the validation in there you should solve the problem.


Best Regards



Hi Ulises,

You can got to Interface tab under Comman->menu and include all the menu that will appear in menu section of all the screen here you can make the condition with admin role for which one perticular menu you want to show it only to the admin role only.

cheers

Thank you both for your responses. When I go into common->menu->Preparation, and put an If before loading the menu items and check for 

SyntaxEditor Code Snippet

Check<my_admin_role>Role(UserId:)

It does not seem to have any effect at all. But the same if condition will work if I enclose the web block inside an if inside one particular screen. Why is that happening?. I also tried to disable the loading_items assignment inside the menu web block preparation, so now I only have start->end nothing in the middle, and the menu still shows. It's not logical, I'm a bit lost.

Solution

Don't put the If inside the preparation but on the things that you want to hide. If you have some expressions and containers inside the menu involve them all in the if and put that check condition in there in order to hide the containers and expressions that you want to "hide". I think that will solve your problem.



Solution

Thank you, you're right, I had to double click the menu web block in the right hand side of the screen, and in the canvas, the items of the menu appear, they are wrapped in an expression, and I only had to wrap that expression in the IF. It works. Thanks again.

Hi Ulises,

If you could mark the answer that most helped you solving your problem, that would help others facing the same situation in the future.

Thanks!