%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ page import="org.crosswire.webtools.RightsAndRoles" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.HashSet" %>
<%@ page import="org.crosswire.utils.Utils" %>
<%@ page import="org.crosswire.utils.HTTPUtils" %>
<%@ page import="org.crosswire.xml.XMLBlock" %>
<%@ page import="org.crosswire.xml.XMLDataElement" %>
<%@ page import="org.crosswire.webtools.*" %>
<%@ page import="org.crosswire.webtools.annotation.*" %>
<%!
@Description(value = "Retrieve usergroups.", name = "usergroup/list")
public static class MyParameters extends Parameters {
@Description(value = "show usage for this web service", defaultValue = "false", example = "true")
public Boolean usage = false;
@Description(value = "header, users", defaultValue = "users", example = "header")
public String detail;
}
%>
<%
MyParameters params = new MyParameters().loadFromRequest(request, response, false);
if (params.getErrors().size() == 0 && !params.usage) {
Set groups = RightsAndRoles.getInstance().getUserGroups();
StringBuffer retVal = new StringBuffer();
retVal.append("");
for (RightsAndRoles.UserGroup u : groups) {
if ("header".equals(params.detail)) {
retVal.append(new XMLDataElement(u).toString());
}
else {
retVal.append(u.formattedString());
}
}
retVal.append("");
Serializer.output(response, out, params, XMLBlock.createXMLBlock(retVal.toString()));
}
else params.format = "html";
Serializer.reportErrors(request, response, out, params, true);
%>