private UserResponse createUserResponse(UserEntity userEntity) {
    List<UserAuthenticationEntity> authenticationEntities = userEntity.getAuthenticationEntities();
    boolean isLdapUser = false;
    UserAuthenticationType userType = UserAuthenticationType.LOCAL;

    for (UserAuthenticationEntity authenticationEntity : authenticationEntities) {
      if (authenticationEntity.getAuthenticationType() == UserAuthenticationType.LDAP) {
        isLdapUser = true;
        userType = UserAuthenticationType.LDAP;
      } else if (authenticationEntity.getAuthenticationType() == UserAuthenticationType.PAM) {
        userType = UserAuthenticationType.PAM;
      }
    }

    Set<String> groups = new HashSet<>();
    for (MemberEntity memberEntity : userEntity.getMemberEntities()) {
      groups.add(memberEntity.getGroup().getGroupName());
    }

    boolean isAdmin = users.hasAdminPrivilege(userEntity);

    UserResponse userResponse = new UserResponse(userEntity.getUserName(),
        userEntity.getDisplayName(),
        userEntity.getLocalUsername(),
        userType,
        isLdapUser,
        userEntity.getActive(),
        isAdmin,
        userEntity.getConsecutiveFailures(),
        new Date(userEntity.getCreateTime()));
    userResponse.setGroups(groups);
    return userResponse;
  }
Gets the users identified by the given request objects.

@param requests the request objects
@return a set of user responses
@throws AmbariException if the users could not be read
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java