public User updateUser( User user ) { // If password is supplied, assume changing of password. // TODO: Consider adding a boolean to the updateUser indicating a password change or not. if ( StringUtils.isNotEmpty( user.getPassword() ) ) { userSecurityPolicy.extensionChangePassword( user ); } saveUser( user ); fireUserManagerUserUpdated( user ); return user; }
public User addUser( User user ) { saveUser( user ); fireUserManagerUserAdded( user ); // If there exists no encoded password, then this is a new user setup if ( StringUtils.isEmpty( user.getEncodedPassword() ) ) { userSecurityPolicy.extensionChangePassword( user ); } return user; }
public User updateUser( User user ) throws UserNotFoundException { if ( !( user instanceof JdoUser ) ) { throw new UserManagerException( "Unable to Update User. User object " + user.getClass().getName() + " is not an instance of " + JdoUser.class.getName() ); } // If password is supplied, assume changing of password. // TODO: Consider adding a boolean to the updateUser indicating a password change or not. if ( StringUtils.isNotEmpty( user.getPassword() ) ) { userSecurityPolicy.extensionChangePassword( user ); } updateObject( (JdoUser) user ); fireUserManagerUserUpdated( user ); return user; }
public User addUser( User user ) { if ( !( user instanceof JdoUser ) ) { throw new UserManagerException( "Unable to Add User. User object " + user.getClass().getName() + " is not an instance of " + JdoUser.class.getName() ); } if ( StringUtils.isEmpty( user.getUsername() ) ) { throw new IllegalStateException( Messages.getString( "user.manager.cannot.add.user.without.username" ) ); //$NON-NLS-1$ } userSecurityPolicy.extensionChangePassword( user ); fireUserManagerUserAdded( user ); // TODO: find a better solution // workaround for avoiding the admin from providing another password on the next login after the // admin account has been created // extensionChangePassword by default sets the password change status to false if ( "admin".equals( user.getUsername() ) ) { user.setPasswordChangeRequired( false ); } else { user.setPasswordChangeRequired( true ); } return (User) addObject( user ); }