70
Views
3
Comments
Role base permission based on attribute value
Service Studio Version
11.53.33 (Build 61790)

Hello,

For my application, I have a project savings table and for each project savings/datapoint, it has its own Business code (e.g. ABC/DEF/GHI etc...). So I would like for there to be a role for the user to be able:

To view all project savings/datapoint with the Business code of "ABC" only for example.  Basically allowing the user to view the data based on a attribute.

How do I go about this? Thank you!


2023-03-16 16-29-51
Paulo Rosário

Hello Low, 

There are 2 ways to set this up:

1. Using Outsystems Roles

  • Define a role for each type of data and map it to an attribute 
  •  Make sure that the user has the permissions necessary to view that data using the CheckRole function in the OnReady Event on the screen. 
  • Depending on the number of attributes this can create a lot of Roles to manage.
  • These Roles can be used as permissions for screens so if your data is divided by screen I can be useful ) 

You can learn more about Roles here.

2. Creating a User Permissions Table

  • Create an entity that has the UserId as a foreign key.
  • In that entity add boolean attributes that match the attributes that you want to use to show/hide information ( HasPermissionsABC for example.)
  • Add a back office to configure user permissions.
  • Create an action to check the roles of the user when needed.

Hope it helps!

Paulo Rosário

UserImage.jpg
Low Nico

Hello Paulo,

Thank you so much for your suggestions! My idea and direction to tackle this issue is similar to your first suggestion which utilises OutSystem's roles. So I would most likely filter the aggregate used to display the data by checking the role of the user.

So basically:

1) Create a new role : ManagerABC

2) Filter the aggregate so that Manager ABC and view all data that has code "ABC"

This seems to be working however, the user with the admin role (Admin role should be able to see everything regardless of code) can only see those with code "ABC" too which is not intended. 

These are the 2 filters that I am using. Did I do something wrong here? Thank you!

UserImage.jpg
muazam azam

There are two ways to configure this:


1. Making use of Outsystems Roles


Each type of data should have a specific role that is mapped to an attribute.

Use the CheckRole function in the OnReady Event on the screen to confirm that the user has the rights required to see that data.

There may be a large number of Roles to handle depending on the quantity of attributes.

If your data is organized by screen, these roles can be used as permissions for that displays.)

From Phonedaddy

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