Revision 4159
Added by daigle almost 16 years ago
LDAPUtil.java | ||
---|---|---|
343 | 343 |
} |
344 | 344 |
|
345 | 345 |
/** |
346 |
* gets a list of organization names from metacat.properties. Parses the csv |
|
347 |
* string into a vector |
|
348 |
* |
|
349 |
* @return a Vector of Strings that hold all available organizations |
|
350 |
* |
|
351 |
* TODO MCD this should be retrieved from ldap instead of metacat.properties |
|
352 |
*/ |
|
353 |
public static Vector<String> getOrganizations() throws UtilException { |
|
354 |
|
|
355 |
Vector<String> shortOrgNames = new Vector<String>(); |
|
356 |
Vector<String> longOrgNames = null; |
|
357 |
|
|
358 |
longOrgNames = PropertyService.getPropertyNamesByGroup("ldap.org"); |
|
359 |
|
|
360 |
for (String longName : longOrgNames) { |
|
361 |
shortOrgNames.add(longName.substring(9)); |
|
362 |
} |
|
363 |
return shortOrgNames; |
|
364 |
} |
|
365 |
|
|
366 |
/** |
|
367 |
* gets a list of organization names from metacat.properties. Parses the csv |
|
368 |
* string into a vector |
|
369 |
* |
|
370 |
* @return a Vector of Strings that hold all available organizations |
|
371 |
*/ |
|
372 |
public static Vector<String> getOrgDNs(String orgName) throws UtilException { |
|
373 |
|
|
374 |
String orgBaseList = null; |
|
375 |
try { |
|
376 |
orgBaseList = PropertyService.getProperty("ldap.base." + orgName); |
|
377 |
} catch (PropertyNotFoundException pnfe) { |
|
378 |
throw new UtilException("Could not get metacat property: ldap.base." |
|
379 |
+ orgName + " : " + pnfe.getMessage()); |
|
380 |
} |
|
381 |
// this will always return a vector (maybe an empty one) |
|
382 |
return StringUtil.toVector(orgBaseList, ','); |
|
383 |
} |
|
384 |
|
|
385 |
/** |
|
386 | 346 |
* Reports whether LDAP is fully configured. |
387 | 347 |
* |
388 | 348 |
* @return a boolean that is true if all sections are configured and false |
Also available in: Unified diff
Add support for separate LDAP and organization level configurations