According to Roles - CUBA Platform. Developer’s Manual a user may have multiple roles, in which case a logical sum (OR) is computed from all of the assigned roles. This means if a user has a back office role and a guest role he would see all the screens/entities which has been created for both roles - correct?
However, in our use case the users expectation is, that he can choose a role after the login, if there are more than one roles assigned to him. Either he sees the screens for the back office user or for the guest user - but not the screens of both. Any suggestion how that could be achieved?
One possible solution is User Substitution: Either creating multiple users (for example: john-backoffice and john-guest) or creating shared users (guest and backoffice and assigning them for all users).
Another solution that may be possible is changing the UserSession after login and the user select which role he wants to use. But I don’t know if it is really possible, I think you’d have to recreate user session (like what is done automatically when using UserSubstituion).