Revision 8471
Added by Jing Tao almost 11 years ago
src/edu/ucsb/nceas/metacat/authentication/AuthFile.java | ||
---|---|---|
199 | 199 |
@Override |
200 | 200 |
/** |
201 | 201 |
* Get all users. This is two-dimmention array. Each row is a user. The first element of |
202 |
* a row is the user name. |
|
202 |
* a row is the user name. The second element is common name. The third one is the organization name (null). |
|
203 |
* The fourth one is the organization unit name (null). The fifth one is the email address. |
|
203 | 204 |
*/ |
204 | 205 |
public String[][] getUsers(String user, String password) |
205 | 206 |
throws ConnectException { |
206 | 207 |
List<Object> users = userpassword.getList(USERS+SLASH+USER+SLASH+AT+DN); |
207 | 208 |
if(users != null && users.size() > 0) { |
208 |
String[][] usersArray = new String[users.size()][1];
|
|
209 |
String[][] usersArray = new String[users.size()][5];
|
|
209 | 210 |
for(int i=0; i<users.size(); i++) { |
210 |
usersArray[i][0] = (String) users.get(i); |
|
211 |
User aUser = new User(); |
|
212 |
String dn = (String)users.get(i); |
|
213 |
aUser.setDN(dn); |
|
214 |
usersArray[i][0] = dn; //dn |
|
215 |
String surname = null; |
|
216 |
List<Object> surNames = userpassword.getList(USERS+SLASH+USER+"["+AT+DN+"='"+dn+"']"+SLASH+SURNAME); |
|
217 |
if(surNames != null && !surNames.isEmpty()) { |
|
218 |
surname = (String)surNames.get(0); |
|
219 |
} |
|
220 |
aUser.setSurName(surname); |
|
221 |
String givenName = null; |
|
222 |
List<Object> givenNames = userpassword.getList(USERS+SLASH+USER+"["+AT+DN+"='"+dn+"']"+SLASH+GIVENNAME); |
|
223 |
if(givenNames != null && !givenNames.isEmpty()) { |
|
224 |
givenName = (String)givenNames.get(0); |
|
225 |
} |
|
226 |
aUser.setGivenName(givenName); |
|
227 |
usersArray[i][1] = aUser.getCn();//common name |
|
228 |
usersArray[i][2] = null;//organization name. We set null |
|
229 |
usersArray[i][3] = null;//organization ou name. We set null. |
|
230 |
List<Object> emails = userpassword.getList(USERS+SLASH+USER+"["+AT+DN+"='"+dn+"']"+SLASH+EMAIL); |
|
231 |
String email = null; |
|
232 |
if(emails != null && !emails.isEmpty() ) { |
|
233 |
email = (String)emails.get(0); |
|
234 |
} |
|
235 |
usersArray[i][4] = email; |
|
236 |
|
|
211 | 237 |
} |
212 | 238 |
return usersArray; |
213 | 239 |
} |
Also available in: Unified diff
Add the common name and email address information into the getUsers method.