Project

General

Profile

« Previous | Next » 

Revision 2559

Added by sgarg about 19 years ago

Modified the code so that users show up outside the groups also in the tree constructed by action=getPrincipals.

View differences:

src/edu/ucsb/nceas/metacat/AuthLdap.java
950 950
  public String getPrincipals(String user, String password) throws
951 951
      ConnectException {
952 952
    StringBuffer out = new StringBuffer();
953
    Vector usersIn = new Vector();
954

  
953
   
955 954
    out.append("<?xml version=\"1.0\" encoding=\"US-ASCII\"?>\n");
956 955
    out.append("<principals>\n");
957 956

  
......
1013 1012
          out.append("      <description>" + groups[i][1] + "</description>\n");
1014 1013
          String[] usersForGroup = getUsers(user, password, groups[i][0]);
1015 1014
          for (int j = 0; j < usersForGroup.length; j++) {
1016
            usersIn.addElement(usersForGroup[j]);
1017

  
1015
            
1018 1016
            userIndex = searchUser(usersForGroup[j], users);
1019 1017
            out.append("      <user>\n");
1020 1018

  
......
1043 1041

  
1044 1042
      // for the users not belonging to any grou8p
1045 1043
      for (int j = 0; j < users.length; j++) {
1046
        if (!usersIn.contains(users[j][0])) {
1047 1044
          out.append("    <user>\n");
1048 1045
          out.append("      <username>" + users[j][0] + "</username>\n");
1049 1046
          out.append("      <name>" + users[j][1] + "</name>\n");
......
1055 1052
          }
1056 1053
          out.append("      <email>" + users[j][4] + "</email>\n");
1057 1054
          out.append("    </user>\n");
1058
        }
1059 1055
      }
1060 1056

  
1061 1057
      out.append("  </authSystem>\n");
1062
      if (!usersIn.isEmpty()) {
1063
        usersIn.removeAllElements();
1064
        usersIn.trimToSize();
1065
      }
1066

  
1067 1058
    }
1068 1059
    out.append("</principals>");
1069 1060
    return out.toString();

Also available in: Unified diff