How do I check if the Current User is an Administrator?

0
Hello, I'm a 2nd year University student working at Siemens for the year and consider myself a newbie Mendix developer.   Just wondering how I can check if the currently logged in user is an administrator? So far, I’ve created a decision block which checks if the logged in user has an administrator username but I want to check the account by type rather than by name. How can I do this? Thanks in advance :)
asked
5 answers
9

The retrieve with: 

[System.UserRoles = $currentUser]
[id = '[%UserRole_Administrator%]']

The decision with 

$UserRole_Administrator != empty

 

answered
3

You can do an retrieve of the entity System.Userrole with the following xpath:

[id = '[%UserRole_Administrator%]']
[System.UserRoles = $currentUser]


If the userrole is retrieved the user is an administrator. If it is empty, it is not. 

answered
0

I receive the following error message when using the above statement:

answered
-1

After a bit of testing I managed to get it working thanks to Maarten Bonger’s explanation:

`

answered
-4

Can”t you do this by using the object decision?

answered