User role set to Access on Login

Hi,

We had scenario were user has been assign more than one Role thorough role assignments.
Example : If admin user is trying to login and we had set role such as System-full-access,Master-user role.
So After Successful Login i want to give popup to user as you have been assign with multiple role , So user will select one role and proceed ahead.So as per the Primary role selected during login he/she must be able to view that access provide for that role.

I want to just confirm if role can be set manually during login and on basis of same he/she can view the workbench.

user_role

Hi!

Its seems feasible. You can use currentAuthentication.getUser(); to get the authenticated user. You can then reassign roles to the user.

    RoleAssignmentEntity rae = dataManager.create(RoleAssignmentEntity.class);
    rae.setUsername("username here");
    rae.setRoleCode("role code here");
    rae.setRoleType("resource");

    dataManager.save(rae);

Best regards,
Dmitriy

Hi,

I dont want to update role for the user, role is already provide to user i just want user to view screen / menu on basis of role provided to the user in role assignment screen.

Below code seem to fetch single role for the user but i want to all role assign to the user and same i want to populate in dropdown list post login on basis of screen select screen menu will be change.

currentAuthentication.getUser().getAuthorities().stream().findFirst().get().getAuthority();