Revision 4627
Added by daigle over 15 years ago
AuthUtil.java | ||
---|---|---|
91 | 91 |
} |
92 | 92 |
|
93 | 93 |
/** |
94 |
* Get the moderators from metacat.properties |
|
95 |
* |
|
96 |
* @return a Vector of Strings holding the moderators |
|
97 |
*/ |
|
98 |
public static Vector<String> getModerators() throws UtilException { |
|
99 |
if (moderators == null) { |
|
100 |
populateModerators(); |
|
101 |
} |
|
102 |
return moderators; |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
94 | 106 |
* Get the vector of administrator credentials from metacat.properties |
95 | 107 |
* and put into global administrators list |
96 | 108 |
*/ |
... | ... | |
137 | 149 |
} |
138 | 150 |
deniedSubmitters = StringUtil.toVector(deniedSubmitterString, ':'); |
139 | 151 |
} |
152 |
|
|
153 |
/** |
|
154 |
* Get the vector of moderator credentials from metacat.properties |
|
155 |
* and put into global administrators list |
|
156 |
*/ |
|
157 |
private static void populateModerators() throws UtilException { |
|
158 |
String moderatorString = null; |
|
159 |
try { |
|
160 |
moderatorString = |
|
161 |
PropertyService.getProperty("auth.moderators"); |
|
162 |
} catch (PropertyNotFoundException pnfe) { |
|
163 |
throw new UtilException("Could not get metacat property: auth.moderators. " |
|
164 |
+ "There will be no registered metacat moderators: " |
|
165 |
+ pnfe.getMessage()); |
|
166 |
} |
|
167 |
moderators = StringUtil.toVector(moderatorString, ':'); |
|
168 |
} |
|
140 | 169 |
|
141 | 170 |
// /** |
142 | 171 |
// * Validate connectivity to the ldap server. This does not test user |
... | ... | |
378 | 407 |
* @param groups |
379 | 408 |
* a list of the user's groups |
380 | 409 |
*/ |
381 |
public static boolean isModerator(String username, String[] groups) { |
|
382 |
return onAccessList(moderators, username, groups);
|
|
410 |
public static boolean isModerator(String username, String[] groups) throws UtilException{
|
|
411 |
return onAccessList(getModerators(), username, groups);
|
|
383 | 412 |
} |
384 | 413 |
|
385 | 414 |
/** |
Also available in: Unified diff
Added code to populate moderators from metacat.properties