Mendix Custom login page and access roles through account

0
I want to create a custom login page were I have a one user with multiple roles. So while logging in i want to select specific role for eg. Niharika is user and have role of Department head and salesmaster head so while login i want to select specific role of the user through UserRoles can you help with this problem. How can i achieve this?
asked
3 answers
0

Hello Niharika,

 

 

Selecting the roles should not be allowed to an anonymous user, it would be a gap in the security.

 

In my opinion you could let the user to login first and only after that you should show them a page where they could select the role.

 

 

Hope this helps!

 

BR,

Inês

answered
0

I agree with Ines that showing the selection on the login page is not allowed because anonymous users should not see the roles.

 

Mendix has no simple solutions for dynamic role switching. A user can have multiple roles, but that doesn't mean one is on or off at a certain moment.

 

First I would argue against the principle of 'role switching' in your UX. Why would you let the user switch roles? Can you not achieve the same functionality by showing the user 2 buttons that access different 'domains' in your application?

 

However, if you want to build something like this, you can interfere while the user logs in. Mendix will always redirect the user to the 'homepage' that you have specified in the navigation of the project (or the specific role-based homepage). Create a homepage on which you show this dropdown with the UserRoles of the CurrentUser.

 

afbeelding.png

 

afbeelding.png

 

 

One thing to be aware of is how the user can 'attach' the lost role again. Does the user has the permissions to add the lost role again to her user account?

 

Well, hope this helps.

answered
0

image.png

 

If a person login for eg Niharika who has 2 role i.e BU_Head and SalesPerson_Master after login i have to select particular role so on select of role the page should be accessible to Niharika 

answered