The save user does not hash the password in ADMIN_ROLE.
I think it is because we are changing the user in the Action outside the transaction
Code in User Action:
if (getRequest().isUserInRole(Constants.ADMIN_ROLE)) {
user.getRoles().clear(); //
APF-788: Removing roles from user doesn't work
String[] userRoles = getRequest().getParameterValues("userRoles");
for (int i = 0; userRoles != null && i < userRoles.length; i++) {
String roleName = userRoles[i];
user.addRole(roleManager.getRole(roleName));
What I did to solve this issue was to have another method in UserManager and call diffrent methods depending on the role eg:
try {
if(!getRequest().isUserInRole(Constants.ADMIN_ROLE)){
userManager.saveUser(user);
}else{
String[] userRoles = getRequest().getParameterValues("userRoles");
userManager.saveUser(user,userRoles);
}
}
I am not sure if I did it the right way.