private User defineBasicUserAttributes() { Date createdOn = new Date(); User createdByUser = (User) SessionService.getSessionAttribute("user"); String createdBy = createdByUser.getUserName(); User newUser = new User(); newUser.setCreatedBy(createdBy); newUser.setCreatedOn(createdOn); newUser.setDisabled(false); newUser.setEmail(email); newUser.setPassword(PasswordService.createHashedPassword(password)); newUser.setUserName(userName); newUser.setFirstName(firstName); newUser.setLastName(lastName); return newUser; }
public String toggleUserActivity(User user) { userToUpdate = user; userToUpdate.setDisabled(!userToUpdate.getDisabled()); userToUpdate.setModifiedOn(new Date()); User modifiedByUser = (User) SessionService.getSessionAttribute("user"); userToUpdate.setModifiedBy(modifiedByUser.getUserName()); registrationDao.mergeUser(userToUpdate); userToUpdate = null; if (user.getDisabled()) { MessageService.displayFacesMessageInfo( "registration_properties", "REGISTRATION_USER_DISABLED_SUMMARY", "REGISTRATION_USER_DISABLED_DETAIL"); } else { MessageService.displayFacesMessageInfo( "registration_properties", "REGISTRATION_USER_ENABLED_SUMMARY", "REGISTRATION_USER_ENABLED_DETAIL"); } return UPDATE_PATH; }