Show Page data according to roles in hardcoded manner.
Question
Application Type
Reactive

Hi Team,

I have a scenario, 

There is a config page having around 12 rows, each row has its own configname, Now, There are roles like manager, Admin, etc. SO, when a manager loggs in and go to this page, it should show some particular rows for him, if Admin loggs in then show data accordingly. I have to do this in a hard codeded manner. Any solutions please...

Hello Aditya,

Please go through this discussion it may help you

https://www.outsystems.com/forums/discussion/54247/filter-aggregate-by-role/

Regards,

Pavan R

Hi Pavan,

I went through that. But, I dont have any attribute or table for role. I have to fulfill my requirement in hardcoded manner.

Hi Aditya,

You can have all rows in the screen and based on role you can set the visible property using roles as Boolean variables.

You can use on initialize () and check the role and assign to screen variable.

Your Javascript node should have an output parameter to which you assign the outcome of the checkIfCurrentUserHasRole() function.

Find the link to get more idea also a sample oml file to hide and show a button based on roles.





CheckRoleJSReactive.oml

Hi Dileep,

I went through your oml. I have a question such as, 

U have taken a button and enclosed an if to it, in condition u kept Ismanager.

My requirement is like, i have a table data and has multiple rows with configname,value etc in it. According to configname, if it is textrecepient, then this config should be visible only to the Admin. So, how shall i go forward for this?

In that case, the once way  you should have one more attribute for role purpose in the list along with value, so that you can check if the current row is (suppose manager role coming from role JS node) specific role then only display.

Hope this will help you to check at dynamically.

Dileep

Hello Aditya,

You may be storing somewhere that this record should be seen to this particular user (You may be storing UserId in your entity) So while creating the config name you can select the employee who can have access to it.

 So I have created the same scenario where I am storing the UserId in to the Employee table and then created another entity called Teams, when you are creating the config name you will be able to select the Approver and  the Owner for that, And in the entity you can filter it like If it is Admin then show all the records else show particular records assigned to the logged in user. Its just a sample, it totally depends on the scenario you face.


Regards,

Pavan R

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