Revision 8473
Added by Jing Tao over 10 years ago
src/edu/ucsb/nceas/metacat/authentication/AuthFile.java | ||
---|---|---|
276 | 276 |
@Override |
277 | 277 |
/** |
278 | 278 |
* Get all groups from the authentication service. It returns a two dimmension array. Each row is a |
279 |
* group. The first column is the group name. The null will return if no group found. |
|
279 |
* group. The first column is the group name. The second column is the description. The null will return if no group found.
|
|
280 | 280 |
*/ |
281 | 281 |
public String[][] getGroups(String user, String password) |
282 | 282 |
throws ConnectException { |
283 | 283 |
List<Object> groups = userpassword.getList(GROUPS+SLASH+GROUP+SLASH+AT+NAME); |
284 | 284 |
if(groups!= null && groups.size() >0) { |
285 |
String[][] groupsArray = new String[groups.size()][1];
|
|
285 |
String[][] groupsArray = new String[groups.size()][2];
|
|
286 | 286 |
for(int i=0; i<groups.size(); i++) { |
287 |
groupsArray[i][0] = (String) groups.get(i); |
|
287 |
String groupName = (String) groups.get(i); |
|
288 |
groupsArray[i][0] = groupName; |
|
289 |
String description = null; |
|
290 |
List<Object>descriptions = userpassword.getList(GROUPS+SLASH+GROUP+"["+AT+NAME+"='"+groupName+"']"+SLASH+DESCRIPTION); |
|
291 |
if(descriptions != null && !descriptions.isEmpty()) { |
|
292 |
description = (String)descriptions.get(0); |
|
293 |
} |
|
294 |
groupsArray[i][1] = description; |
|
288 | 295 |
} |
289 | 296 |
return groupsArray; |
290 | 297 |
} |
... | ... | |
300 | 307 |
throws ConnectException { |
301 | 308 |
List<Object> groups = userpassword.getList(USERS+SLASH+USER+"["+AT+DN+"='"+foruser+"']"+SLASH+GROUP); |
302 | 309 |
if(groups != null && groups.size() > 0) { |
303 |
String[][] groupsArray = new String[groups.size()][1];
|
|
310 |
String[][] groupsArray = new String[groups.size()][2];
|
|
304 | 311 |
for(int i=0; i<groups.size(); i++) { |
305 |
groupsArray[i][0] = (String) groups.get(i); |
|
312 |
String groupName = (String) groups.get(i); |
|
313 |
groupsArray[i][0] = groupName; |
|
314 |
String description = null; |
|
315 |
List<Object>descriptions = userpassword.getList(GROUPS+SLASH+GROUP+"["+AT+NAME+"='"+groupName+"']"+SLASH+DESCRIPTION); |
|
316 |
if(descriptions != null && !descriptions.isEmpty()) { |
|
317 |
description = (String)descriptions.get(0); |
|
318 |
} |
|
319 |
groupsArray[i][1] = description; |
|
306 | 320 |
} |
307 | 321 |
return groupsArray; |
308 | 322 |
} |
Also available in: Unified diff
Add the description in the getGroups methods.