How to change role in a microflow

0
Here`s the thing. I want to make a login page, in which those users in “guest” role could enter their account ID and password and therefore change to “user” role and access more stuff. Yet, I didn`t find a thing that can change user role in microflow. So how can I do that?
asked
2 answers
0

You cannot directly upgrade a guest user nor upgrade a guest session to have more access rights. Instead you must create a new session for the user.

The simplest approach would be to use the “Sign in” widgets available in your toolbox to create a login page for guest users. After the user clicks on the login button, their page will refresh and they’ll be taken to the home page for their new user role.

If you need some other functionality beyond this, it’s possible but a bit more complicated. Please respond with more details if that’s needed.

answered
0

Typically you don't need to update the userRoles of an user in a Microflow.

If you create an user in Mendix you will assign him one or more userRoles. This is stored in the database.

When the user visits the application he is an Anonymous user (if you use the custom login page... when you use login.html it won't create the anonymous user and session). When the visitor successfully signs in into Mendix, Mendix will create a new session for the user with the roles assigned to his user (account). No need to assign any roles to the user at that point. Unless you need some dynamic role assignment this should be sufficient.

answered