Project

General

Profile

« Previous | Next » 

Revision 4588

Added by daigle over 15 years ago

Add a getAttributes method to pass through the getAttributes defined in the AuthInterface.

View differences:

src/edu/ucsb/nceas/metacat/AuthSession.java
27 27
package edu.ucsb.nceas.metacat;
28 28

  
29 29
import java.net.ConnectException;
30
import java.util.HashMap;
31
import java.util.Vector;
32

  
30 33
import javax.servlet.http.HttpSession;
31 34
import javax.servlet.http.HttpServletRequest;
32 35

  
33 36
import org.apache.log4j.Logger;
34 37

  
35 38
import edu.ucsb.nceas.metacat.service.PropertyService;
36
import edu.ucsb.nceas.metacat.util.LDAPUtil;
39
import edu.ucsb.nceas.metacat.util.AuthUtil;
37 40
import edu.ucsb.nceas.metacat.util.UtilException;
38 41

  
39 42
/**
......
174 177
	public String getPrincipals(String user, String password) throws ConnectException {
175 178
		return authService.getPrincipals(user, password);
176 179
	}
180
	
181
	/**
182
	 * Get attributes describing a user or group
183
	 * 
184
	 * @param foruser
185
	 *            the user for which the attribute list is requested
186
	 * @returns HashMap a map of attribute name to a Vector of values
187
	 */
188
	public HashMap<String, Vector<String>> getAttributes(String foruser)
189
			throws ConnectException {
190
		return authService.getAttributes(foruser);
191
	}
177 192

  
178 193
	/*
179 194
	 * format the output in xml for processing from client applications
180
	 *
181
	 * @param tag the root element tag for the message (error or success)
182
	 * @param message the message content of the root element
195
	 * 
196
	 * @param tag the root element tag for the message (error or success) @param
197
	 * message the message content of the root element
183 198
	 */
184 199
	private String formatOutput(String tag, String message) {
185 200
		return formatOutput(tag, message, null, null, null, null);
......
210 225

  
211 226
			try {
212 227
				// insert <isAdministrator> tag if the user is an administrator
213
				if (LDAPUtil.isAdministrator(username, groups)) {
228
				if (AuthUtil.isAdministrator(username, groups)) {
214 229
					out.append("\n  <isAdministrator></isAdministrator>\n");
215 230
				}
216 231
			} catch (UtilException ue) {
......
219 234
			}
220 235

  
221 236
			// insert <isModerator> tag if the user is a Moderator
222
			if (LDAPUtil.isModerator(username, groups)) {
237
			if (AuthUtil.isModerator(username, groups)) {
223 238
				out.append("\n  <isModerator></isModerator>\n");
224 239
			}
225 240
		}

Also available in: Unified diff