1295
Views
8
Comments
Solved
How to disable or enable button based on user roles
Question

Hi Team,

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


Thanks  in  Advance.



Regards,

Kallol


2017-03-03 12-48-17
Balasubramanian Prakasam
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

2017-02-23 11-12-25
Eric Halim

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


UserImage.jpg
Kallol Jena

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


UserImage.jpg
Sarkis Kirkoriyan

Hallo, 

I have the same problem can you gif a working exambel? Check<rolename>(userid)  meens nothing to me!

Thanks.

Best regard,


2018-08-26 20-34-32
Pankaj pant

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

UserImage.jpg
Kallol Jena

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


UserImage.jpg
Kleber Quilez



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.

2021-03-18 21-03-15
Benjith Sam
 
MVP

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

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.