trying to make certain buttons visible by role

0
Hi, In the 1st row, if the user is an administrator, they should just see save and cancel in the 2nd row, if the user is a simple user, they should just see the close button.  That’s because at the entity level, the user can only read the data.  The attributes are automatically in read only on the page.  Therefore we do not need to show save and close, just close. I was trying to put the close button beside the save and cancel to prevent the need for another row.   Results: when the simple logs in, they can see just the close button (no matter how I do it) but when an administrator user logs in, they can see save, cancel, and close (either beside the buttons or in this case below) Any ideas? Thanks, Daniel     At the table level At the row level:   
asked
6 answers
4

If it is about user roles that are not allowed to execute an action, it would be better (from a security standpoint) to not make it invisible via a visibility constraint. You should make the microflow behind that button only executable for defined roles. The button will disappear for all other roles.

answered
2

Hi Daniel,

If the administrator can see both rows that means the administrator user role has the “administrator” module role and the “user” module role. The way that you are building your page then a user role should either have either “administrator” or “user” as a module role, not both.

Also, the same conditional visibility settings exist on the buttons. If you open the buttons properties, there is a visibility section where you can configure the button to show based on certain module roles. 

 

Hope this helps!

answered
0

 

The top buttons is the container way

and bottom one is the grid layout way or button way

 

answered
0

If you want to display buttons from different contains in one line then you should add the ‘display: inline-block;’ to the container css.

This will move the containers inline and the user will see all the buttons on one line, even if they have different roles

Hope this helps.

Tom

answered
0

By the way: Shouldn’t Mendix show/hide the Save and Cancel buttons similar to a microflow-button: only show when the user’s role has entity write-access?

That would make this question’s scenario a lot simpeler.

answered
0

 

The reason why the administrator was considered a user is because in the screen below the user choice was checked

 

 

answered