public static List searchGroups(GrouperSession s, String query, String from, String searchInDisplayNameOrExtension, String searchInNameOrExtension,String browseMode) throws Exception{ String type = null; List res = searchGroups(s, query, from,searchInDisplayNameOrExtension,searchInNameOrExtension); if (res != null) return res; List returnRes = new ArrayList(); Set allowedSet = null; if ("All".equals(browseMode)) { return res; } else if ("".equals(browseMode)) { allowedSet = GrouperHelper.getMembershipsSet(s); } else if ("Manage".equals(browseMode)) { allowedSet = GrouperHelper.getGroupsForPrivileges(s, new String[] { "admin", "update", "read" }); } else if ("Join".equals(browseMode)) { allowedSet = GrouperHelper.getGroupsForPrivileges(s, new String[] { "optin" });
public static List searchGroups(GrouperSession s, String query, String from,String searchInDisplayNameOrExtension,String searchInNameOrExtension) throws StemNotFoundException,QueryException{ List displayResults = null; List nonDisplayResults=null; String attr = null; if(!"".equals(searchInDisplayNameOrExtension)) { if("name".equals(searchInDisplayNameOrExtension)) { attr="displayName"; }else{ attr="displayExtension"; } displayResults = searchGroupsByAttribute(s,query,from,attr);
	public static List searchGroups(GrouperSession s, String query,			String from, String searchInDisplayNameOrExtension,			String searchInNameOrExtension,String browseMode) throws Exception{		String type = null;		List res = searchGroups(s, query, from,searchInDisplayNameOrExtension,searchInNameOrExtension);		if (res != null)			return res;		List returnRes = new ArrayList();		Set allowedSet = null;		if ("All".equals(browseMode)) {			return res;		} else if ("".equals(browseMode)) {			allowedSet = GrouperHelper.getMembershipsSet(s);		} else if ("Manage".equals(browseMode)) {			allowedSet = GrouperHelper.getGroupsForPrivileges(s,					new String[] { "admin", "update",							"read" });		} else if ("Join".equals(browseMode)) {			allowedSet = GrouperHelper.getGroupsForPrivileges(s,					new String[] { "optin" });		}		if (allowedSet != null) {			Map allowed = new HashMap();			Iterator it = allowedSet.iterator();			Group group;			while (it.hasNext()) {				group = (Group) it.next();				allowed.put(group.getUuid(),Boolean.TRUE);			}						for (int i = 0; i < res.size(); i++) {				group = (Group) res.get(i);				if (allowed.containsKey(group.getUuid()))					returnRes.add(group);			}		}		return returnRes;	}