Project

General

Profile

« Previous | Next » 

Revision 10336

Added by Jing Tao almost 7 years ago

Add a new method to get all groups for a given user.

View differences:

AuthSession.java
276 276

  
277 277
		return out.toString();
278 278
	}
279
	
280
	
281
	/**
282
	 * Get the all groups in which the given userDN is
283
	 * @param logInUserName it can be null
284
	 * @param logInUserPassword it can be null
285
	 * @param userDN
286
	 * @return null if no groups were found for the userDN
287
	 */
288
	public String[] getGroups(String logInUserName, String logInUserPassword, String userDN) throws Exception{
289
	    String[][] groupsWithDescription = authService.getGroups(logInUserName,
290
	            logInUserPassword, userDN);
291
        String groups[] = null;
292
        if(groupsWithDescription != null) {
293
            groups = new String[groupsWithDescription.length];
294
            for (int i = 0; i < groupsWithDescription.length; i++) {
295
                groups[i] = groupsWithDescription[i][0];
296
                logMetacat.debug("AuthSession.getGroups - found that user "+userDN+" is the member of the group "+groups[i]);
297
            }
298
        }
299
        return groups;
300
	}
279 301

  
280 302
	/**
281 303
	 * Instantiate a class using the name of the class at runtime

Also available in: Unified diff