%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page trimDirectiveWhitespaces="true" %> <%@ page import="java.util.Set" %> <%@ page import="java.util.HashSet" %> <%@ page import="org.crosswire.xml.XMLBlock" %> <%@ page import="org.crosswire.community.RightsAndRoles" %> <%@ page import="org.crosswire.community.projects.ntmss.data.ProjectManagement" %> <%@ page import="org.crosswire.community.projects.ntmss.data.ProjectManagement.Project" %> <% long userGroupID = -1; try {userGroupID = Long.parseLong(request.getParameter("userGroupID"));} catch (Exception e){} long userID = -1; try {userID = Long.parseLong(request.getParameter("userID"));} catch (Exception e) {} String userGroupName = request.getParameter("userGroupName"); String userName = request.getParameter("userName"); Set retVal = new HashSet(); if (userID > -1 || userName != null || userGroupID > -1 || userGroupName != null) { response.setContentType("text/xml"); if (userGroupID > -1) { RightsAndRoles.UserGroup ug = RightsAndRoles.getInstance().getUserGroup(userGroupID); if (ug != null) retVal.add(ug); } else if (userGroupName != null) { RightsAndRoles.UserGroup ug = RightsAndRoles.getInstance().getUserGroup(userGroupName); if (ug != null) retVal.add(ug); } else if (userID > -1) { retVal = RightsAndRoles.getInstance().getUserGroups(userID); } else if (userName != null) { retVal = RightsAndRoles.getInstance().getUserGroups(userName); } %> <% for (RightsAndRoles.UserGroup u : retVal) { Project p = ProjectManagement.getProject(u.getUserGroupName()); if (p != null) { u.addBlock(XMLBlock.createXMLBlock(p.toFormattedXML())); } out.print(u.formattedString()); } %> <% return; } %> usergroup/get Retrieve usergroups Parameters userGroupIDuser group id to retrieve userGroupNameuser group name to retrieve userIDget all group for a specific user id userNameget all group for a specific user name
Retrieve usergroups