Widget level editability/visibility based on user roles

0
How do I check the Current User having Administrative role to make a field editable/visible or not at the page level? I recognize that UserRoles is a list so am looking for something like '... contains 'Administrator'? Also recognize this could be handled at the Security/Entity level but want to understand how to do it at page level.  
asked
3 answers
0

Hi GK, 

Since a user can have a list of roles you can't write an expression to check if a specific user has the administrator role. If there is a certain module role that only an administrator will have you can use the conditional visibility to show the editable field based on this module role. 

 

Or you can check out this widget that determines conditional visibility based on a microflow. You can do a retrieve on the user role table to check for the admin user role with this constraint.

[System.UserRoles = $currentUser]
[Name = 'Administrator']


https://appstore.home.mendix.com/link/app/2539/First-Consulting/ShowByCondition

 

Edit: conditional visibility is set here 

answered
0

Alternatively, if you set permissions at the entity level (i.e. only administrators can read or write a given attribute), that attribute will not show up on any pages unless the user has the correct roles.

answered
0

strangely the security settings in System are read-only so I cannot alter the entity security...

 

answered