Dynamic view/edit Access Control from admin page

0
i have 3 userroles and 3 activities, where userrole is the default configuration. I have to give access to each userrole for each activity using switch widget from the admin page. How do i do this in mendix
asked
3 answers
0

you can add different containers and enable visibility for each container of a role. 

image.png

answered
0

image.png

 

It should be like this where the planner,etc,.. are userroles and the plans are pages. the access should be given from the admin side using switch button dynamically

answered
0

Is your example the same for each user with the specific user role? So each planner has access to the Project Plan..

 

There might be two options.

1) For each of the accesses you want to define (eg ProjectPlan), you create a user role (ProjectPlanUser) linked to the specific module role access (ProjectPlanUser linked to Module.ProjectPlanUser with access to Page1, MicroflowX, etc). When you add a user (eg Planner), you will check what switches are on from the configuration side and you will add the additional user roles. Next to that you will need to create logic to remove the user roles when you switch to 'no access'.

2) You will need to store the 'has access to...' for each account. You will then have to set up logic (eg on a dashboard/landing page, because regular menu is looking at the user roles), that will retrieve the information from the user (page context should be the user in a dataview, eg with a DataSource microflow to get the correct account). On the page you will have buttons to the different buttons or area's (eg Project Plan) that you can show or hide using the visibility settings of the button or container based on the 'has access to' attribute). Of course you will also have to make sure that you cannot reach the pages, logic and data via a backdoor. So for instance you will have to create a check either on the detail project plan pages as well, or in microflows leading to these pages.

 

Option 2 is more work to maintain, I guess, so I would opt for Option 1.

answered