addMessage("yourProfile.passwordResetError");
}
}
try {
UserManager mgr = WebloggerFactory.getWeblogger().getUserManager();
// grant/revoke admin role if needed
if (getUser().hasRole("admin") && !getBean().isAdministrator()) {
if (!isUserEditingSelf()) {
// revoke role
mgr.revokeRole("admin", getUser());
} else {
addError("userAdmin.cantChangeOwnRole");
}
} else if(!getUser().hasRole("admin") && getBean().isAdministrator()) {
if (!isUserEditingSelf()) {
// grant role
getUser().grantRole("admin");
} else {
addError("userAdmin.cantChangeOwnRole");
}
}
RollerContext.flushAuthenticationUserCache(getUser().getUserName());
// save the updated profile
mgr.saveUser(getUser());
WebloggerFactory.getWeblogger().flush();
addMessage("userAdmin.userSaved");
return INPUT;