Change $currentUser role

Current User role is ‘Administer’ ($currentUser) , how can I set this $currentUser to ‘Configurator’
1 answers

Hi Mohammed,

try out this steps in a microflow:

  1. Retrieve the userRole you want to assign from the database (retrieve first object from db with xpath  Constraint [Name = 'Configurator']
  2. Then add a change object action in the microflow, select currentUser as object and pick the association ‘System.UserRoles’ as member. Finally add the retrieved Configurator object to the system.UserRoles member and commit.


Be aware that by default the user can be assigned to multiple userRoles. So if the user should only have the Configurator Role, you have to remove the Admin role as well. Another way to manage user roles on the front end is to use the AccountManagement module. Manage Local Users in Studio | Mendix Documentation