Want to hide dashboard from users with no manager role

I created one application where I want to hide the dashboard menu from normal user but I am facing some issues while in IF true condition where when I pass the role name.

CheckApproverRole()

It does not accept.

Hi Malalai,

Your CheckApproverRole() action works only server side.

In Reactive Web Apps and Mobile Apps you can use the Javascript API in order to perform client side role checking.

Here are some other related posts.

https://www.outsystems.com/forums/discussion/37920/role-based-menu-and-homescreen-in-mobile/

https://www.outsystems.com/forums/discussion/26565/define-role-access-to-a-mobile-app/#Post99921

Regards,

Nordin

Malalai Habib wrote:

I created one application where I want to hide the dashboard menu from normal user but I am facing some issues while in IF true condition where when I pass the role name.

CheckApproverRole()

It does not accept.

Hi Malalai, to check role in the reactive you must use the Javascript API as Nordin said

Here in this post you have an example of how to do it, with the oml to help you to replicate the logic

https://www.outsystems.com/forums/discussion/61033/screen-visibility/#Post236790


Best regards

Carlos Lessa


Carlos Lessa wrote:

Malalai Habib wrote:

I created one application where I want to hide the dashboard menu from normal user but I am facing some issues while in IF true condition where when I pass the role name.

CheckApproverRole()

It does not accept.

Hi Malalai, to check role in the reactive you must use the Javascript API as Nordin said

Here in this post you have an example of how to do it, with the oml to help you to replicate the logic

https://www.outsystems.com/forums/discussion/61033/screen-visibility/#Post236790


Best regards

Carlos Lessa



Dear Carlos,

Thank you for your reply I am very new in outsystem I followed all the steps you mention but I think it is not what I want I just wast to hide one of the dashboard menu from the some users which I couldn't hide after the above steps. 


$parameters.IsApprover = $public.Security.checkIfCurrentUserHasRole($roles.Approver);



Hi Malalai,


Go menu webblock in common flow  create  action on OnInitialize" to check role.

After that this output parameter assign in local variable and use local variable to show hide property.



Regards

Rahul Sahu

Malalai Habib wrote:


$parameters.IsApprover = $public.Security.checkIfCurrentUserHasRole($roles.Approver);



Your pics are blank


Malalai Habib wrote:

Carlos Lessa wrote:

Malalai Habib wrote:

I created one application where I want to hide the dashboard menu from normal user but I am facing some issues while in IF true condition where when I pass the role name.

CheckApproverRole()

It does not accept.

Hi Malalai, to check role in the reactive you must use the Javascript API as Nordin said

Here in this post you have an example of how to do it, with the oml to help you to replicate the logic

https://www.outsystems.com/forums/discussion/61033/screen-visibility/#Post236790


Best regards

Carlos Lessa



Dear Carlos,

Thank you for your reply I am very new in outsystem I followed all the steps you mention but I think it is not what I want I just wast to hide one of the dashboard menu from the some users which I couldn't hide after the above steps. 

Can you share the oml with your logic? 


Rahul Sahu wrote:

Hi Malalai,


Go menu webblock in common flow  create  action on OnInitialize" to check role.

After that this output parameter assign in local variable and use local variable to show hide property.



Regards

Rahul Sahu


I did not understand kindly elaborate it little more.

Thank you. Rahul.

Malalai Habib wrote:


$parameters.IsApprover = $public.Security.checkIfCurrentUserHasRole($roles.Approver);



The condition here in the pic is the local variable = HasApproverRole

and inside the JS you need to have this:

$parameters.IsApprover = $public.Security.checkIfCurrentUserHasRole($roles.Approver);

Check the oml attached, adapted to Approver role

Best regards

Carlos Lessa


Solution

Malalai Habib wrote:

Dear Carlos,

Thank you for your reply I am very new in outsystem I followed all the steps you mention but I think it is not what I want I just wast to hide one of the dashboard menu from the some users which I couldn't hide after the above steps. 

Can you share the oml with your logic? 


You are doing the logic in the wrong place, you must do on the menu, check the pic bellow

I did the changes on the oml attached check if will work

Solution

Carlos Lessa wrote:

Malalai Habib wrote:


Dear Carlos,

Thank you for your reply I am very new in outsystem I followed all the steps you mention but I think it is not what I want I just wast to hide one of the dashboard menu from the some users which I couldn't hide after the above steps. 


Can you share the oml with your logic? 


You are doing the logic in the wrong place, you must do on the menu, check the pic bellow

I did the changes on the oml attached check if will work

Thank you dear it is working fine now.

Malalai Habib wrote:

Thank you dear it is working fine now.

Good I could help you

Best regards

Carlos Lessa