How to create and set a role for Users to edita data?
Question

How to create and set a role for Users to edit data?

For example :

  • check that only persons assigned to this role can see the overview and edit the data, so that what will be the logic for this above question.



Thank you

So, you can do that on the Users Management or you can do it by creating a screen and assigning the role to the users. But is easier to go to the Users Management.

https://<yourEnvironmentName>.outsystemscloud.com/Users/

You can create a role on the service studio, on the logic tab and on the users' management, you can create a role and you can assign the role to a user, or to a group, etc.

After this, you just need to call the action, check, or you can just deactivate the check option on the screen for the User. With that, just Users with that role can enter and edit.

Have a look

https://www.outsystems.com/training/courses/131/role-based-security/

https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application/User_Roles/Create_and_Use_Roles?_gl=1*17m24lb*_ga*MTg4ODIwMjQ2OS4xNjQ5OTIxOTkw*_ga_ZD4DTMHWR2*MTY1MDA5NjUzMC4xMC4xLjE2NTAwOTcwODguMzg.

Hi @Swathi T,

after checking the videos and documentation Márcio gave you, it's a good idea to always use logic to check roles in the client-side and server-side (Client Actions and Server Actions). In the server actions, just be sure to call again the CheckRole with GetUserId() and not any parameter coming from the client-side!


In the logic flow, if the CheckRole returns false, you can end the flow (and even set a Boolean with Success as false). If it's all good, proceed with the edit operations.


For entire screens' access it's even easier: after setting a new role in Service Studio, each screen will let you mark a checkbox if user with that Role can access the screen. And you can even check/uncheck multiple screens at a time! You will also have options to show screen to everyone (Anonymous) or only to Registered users (with or without any role).


Please let me know if this has helped you in any way!

Thanks,

Fábio

IMG_20220417_041324.jpg

Hi Swati,

You can create the Roles in the service Studio itself, under the Logic tab, there is one folder of "Role" where you can add a specific role for Ex "Admin". And then you must go to User's Application, you can log in to the User's app with your Outsystems credentials. Path for the same is <https://Your personal Environment/Users>. In users application you will see list of users, by clicking any one of them you will find that there is an Option to add the roles, under the Roles subheading. you can then easily assign the Admin role to that user by typing "Admin" in the input box provided to you. It will show you the app name with the Role.

now you need to check the role for that particular user so, that the user can have the role to edit the data. You must go to service studio, in your app, from where you wanted the edit data in that(Ex Button/Link). First you need to create a data action  with the output parameter type Boolean and in action you need to drag and Drop the "CheckAdminRole" action associated with the role you have created.This CheckRole action has a run time  output parameter of "CheckAdminRole.HasRole" of type boolean, which tells us that a particular user has a Role or not.Now just drag an assgn operator below the CheckAdminRole action and set the data action's output parameter equals the "CheckAdminRole.HasRole". Now you just need to use the data action's ouptut through which you wanted to perform edit funtionality. like the enable and visible property of a link/button.

Appending some images for your reference.


And Yes please do not forgot to go through the learning path of role based security.


Hope It helps!

Thanks


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