screen visibility

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me


Hi,

Is that for Tradition web application? If yes, you can access roles directly in if conditions like below snap,

JitendraYadav wrote: Hello Jitendra.

This is Traditional web app but if condition is not assess role  directly.

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me


Hi,

Is that for Tradition web application? If yes, you can access roles directly in if conditions like below snap,



harish sharma wrote:

JitendraYadav wrote: Hello Jitendra.

This is Traditional web app but if condition is not assess role  directly.

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me


Hi,

Is that for Tradition web application? If yes, you can access roles directly in if conditions like below snap,




Use CheckRegisteredRole in if conditions like

CheckOSMDbAdminRole(UserId:) = Rolels.Admin

Also, Sharing OutSystems Training link which was already covered roles exercise.


https://www.outsystems.com/learn/lesson/883/security-exercise


Thanks

All roles you have created in your application has the Check, Grant and Revoke actions available. So you just need to use the CheckApp1Role(UserId) that returns a boolean.


harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me

Hi Harish here is a screenshot of what you need to do:

1 - Need to have the role you want to check against (Manager in your case)

2 - Use the Check from this role in the IF condition - CheckManagerRole(UserId:)

3 - Get the user logged in - GetUsedId()

4 - Apply on the condition the combination - CheckManagerRole(GetUsedId())

Check the documentation: https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application

I would advise that when you have extra time, follow the online training (Reactive Web, Mobile, Traditional Web) that will give a lot of information and help on your projects(in case you didn't)

Best regards

Carlos Lessa

Carlos Lessa wrote:Hi Carlos.

Thank you.

i Did the same but in if condation Role(CheckMAnagerRole(UserID:) is not appear. 

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me

Hi Harish here is a screenshot of what you need to do:

1 - Need to have the role you want to check against (Manager in your case)

2 - Use the Check from this role in the IF condition - CheckManagerRole(UserId:)

3 - Get the user logged in - GetUsedId()

4 - Apply on the condition the combination - CheckManagerRole(GetUsedId())

Check the documentation: https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application

I would advise that when you have extra time, follow the online training (Reactive Web, Mobile, Traditional Web) that will give a lot of information and help on your projects(in case you didn't)

Best regards

Carlos Lessa



harish sharma wrote:

Carlos Lessa wrote:Hi Carlos.

Thank you.

i Did the same but in if condation Role(CheckMAnagerRole(UserID:) is not appear. 

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me

Hi Harish here is a screenshot of what you need to do:

1 - Need to have the role you want to check against (Manager in your case)

2 - Use the Check from this role in the IF condition - CheckManagerRole(UserId:)

3 - Get the user logged in - GetUsedId()

4 - Apply on the condition the combination - CheckManagerRole(GetUsedId())

Check the documentation: https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application

I would advise that when you have extra time, follow the online training (Reactive Web, Mobile, Traditional Web) that will give a lot of information and help on your projects(in case you didn't)

Best regards

Carlos Lessa



Did you create the ManagerRole? 

Right click on role and add the role you need


Can you take a pic from the roles? and from the if condition?


Carlos Lessa wrote:

harish sharma wrote:

Carlos Lessa wrote:Hi Carlos.

Thank you.

i Did the same but in if condation Role(CheckMAnagerRole(UserID:) is not appear. 

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me

Hi Harish here is a screenshot of what you need to do:

1 - Need to have the role you want to check against (Manager in your case)

2 - Use the Check from this role in the IF condition - CheckManagerRole(UserId:)

3 - Get the user logged in - GetUsedId()

4 - Apply on the condition the combination - CheckManagerRole(GetUsedId())

Check the documentation: https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application

I would advise that when you have extra time, follow the online training (Reactive Web, Mobile, Traditional Web) that will give a lot of information and help on your projects(in case you didn't)

Best regards

Carlos Lessa



Did you create the ManagerRole? 

Right click on role and add the role you need


Can you take a pic from the roles? and from the if condition?




harish sharma wrote:

Carlos Lessa wrote:

harish sharma wrote:

Carlos Lessa wrote:Hi Carlos.

Thank you.

i Did the same but in if condation Role(CheckMAnagerRole(UserID:) is not appear. 

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me

Hi Harish here is a screenshot of what you need to do:

1 - Need to have the role you want to check against (Manager in your case)

2 - Use the Check from this role in the IF condition - CheckManagerRole(UserId:)

3 - Get the user logged in - GetUsedId()

4 - Apply on the condition the combination - CheckManagerRole(GetUsedId())

Check the documentation: https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application

I would advise that when you have extra time, follow the online training (Reactive Web, Mobile, Traditional Web) that will give a lot of information and help on your projects(in case you didn't)

Best regards

Carlos Lessa



Did you create the ManagerRole? 

Right click on role and add the role you need


Can you take a pic from the roles? and from the if condition?




you didnt send pic from the condition on the if?

to be fast or help you best, can you upload the oml?


I got it, you are using Reactive web app and CheckRole function works in server-side so you cant use on reactive and mobile

to check the role you need to use OutSystems JavaScript API 


Check what I did in this oml and replicate on yours



Solution

To give you context:

I added a boolean local variable: HasManagerRole

Added event onReady to the page

Javascript checking the role with output parameter IsManager: $parameters.IsManager = $public.Security.checkIfCurrentUserHasRole($roles.Manager);

Condition of if: Local variable HasManagerRole



Hope I could help you

Best Regards

Carlos Lessa

Solution