public synchronized void setUserActive(UserEntity userEntity, final boolean active) throws AmbariException {
    if (userEntity != null) {
      Command command = new Command() {
        @Override
        public void perform(UserEntity userEntity) {
          userEntity.setActive(active);
        }
      };

      safelyUpdateUserEntity(userEntity, command, MAX_RETRIES);
    }
  }
Enables/disables user.

@param userEntity the user
@param active     true if active; false if not active
@throws AmbariException if user does not exist
ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java