How to disable or enable button based on user roles

Hi Team,

I am  completely  new  to  Outsystems. I want  to  enable  edit  button  based  on  user role.


Thanks  in  Advance.



Regards,

Kallol


Solution

Hi Kallol,

You can do by checking the roles by user, do the following,

In service studio -> Logic -> Roles -> (your user role), when you expand you see 3 actions pre-defined by default, Like 

1) Check<rolename>

2) Grand<rolename>

3) Revoke<rolename>


Here you can use this in your screen by calling Check<rolename> action passing the logged-in user.

After you use if widget and make condition "Check<rolename>(userid)", true part put real button enabled, and else part put dummy button with disabled.

This way no one do tricks to enable the button from client side.


Thanks,

Balu

Solution

Kallol Jena wrote:

Hi Team,

I am  completely  new  to  Outsystems. I want  to  enable  edit  button  based  on  user role.


Thanks  in  Advance.



Regards,

Kallol



Hi Kallol,

If you are completely new I would suggest going with the online course before you start anything they have explained each and everything there.

refer this link for the reference.


Regards,

Pankaj Pant

Pankaj pant wrote:

Kallol Jena wrote:

Hi Team,

I am  completely  new  to  Outsystems. I want  to  enable  edit  button  based  on  user role.


Thanks  in  Advance.



Regards,

Kallol



Hi Kallol,

If you are completely new I would suggest going with the online course before you start anything they have explained each and everything there.

refer this link for the reference.


Regards,

Pankaj Pant

Hi  Pankaj,


Thanks  for  your  reply.

I watched  all  the  videos  whatever  present  in  Youtube. But,I didn't  find  any  solution.


Regards,

Kallol


Balu wrote:

Hi Kallol,

You can do by checking the roles by user, do the following,

In service studio -> Logic -> Roles -> (your user role), when you expand you see 3 actions pre-defined by default, Like 

1) Check<rolename>

2) Grand<rolename>

3) Revoke<rolename>


Here you can use this in your screen by calling Check<rolename> action passing the logged-in user.

After you use if widget and make condition "Check<rolename>(userid)", true part put real button enabled, and else part put dummy button with disabled.

This way no one do tricks to enable the button from client side.


Thanks,

Balu

Nice tips


Balu wrote:

Hi Kallol,

You can do by checking the roles by user, do the following,

In service studio -> Logic -> Roles -> (your user role), when you expand you see 3 actions pre-defined by default, Like 

1) Check<rolename>

2) Grand<rolename>

3) Revoke<rolename>


Here you can use this in your screen by calling Check<rolename> action passing the logged-in user.

After you use if widget and make condition "Check<rolename>(userid)", true part put real button enabled, and else part put dummy button with disabled.

This way no one do tricks to enable the button from client side.


Thanks,

Balu

Hi Balu,

Thank you  very much.


It  helped   me  a  lot .


Thanks,

Kallol




Hello I am new to Outsystems and I would like to understand where my error is here in this syntax. I would like to take the value of the adm rule, to check if the user belongs to the adm group or not. I appreciate the help of friends! Thankful.

Kleber Quilez wrote:



Hello I am new to Outsystems and I would like to understand where my error is here in this syntax. I would like to take the value of the adm rule, to check if the user belongs to the adm group or not. I appreciate the help of friends! Thankful.

 Hi Kleber,

You can't define an Expression or a function call in the Default value field of a Boolean Local Variable instead you can only pass the Boolean Literal i.e. True or False. For your use-case, add an Assign node in the start of the preparation action flow with LHS leveluser = CheckAdminRole(UserId) RHS


"Next time please create your own post for your own problem. Now you added your question to an existing thread that has already a reply marked as a solution. If someone gives you a reply it cannot be marked as solution, and thereby it will be less visible to other OutSystems community members. "


Hope this helps you!


Regards,

Benjith Sam