User's Manual

160 Chapter 12. Presentation (Bebop) Tutorial
HttpServletRequest req,
HttpServletResponse resp)
throws IOException, ServletException {
RequestContext rctx = DispatcherHelper.getRequestContext(req);
String url = rctx.getRemainingURLPart();
// serve page as usual, except for URLs foo/*; those get a
// special-case stylesheet
if (!url.startsWith("foo/")) {
super.servePage(p, req, resp);
} else {
// use custom stylesheet for foo/*
// in reality, probably cache Transformer for performance
Stylesheet fooSS = ... get overridden rules
from somewhere ...;
Transformer xformer = fooSS.newTransformer();
Document doc = p.buildDocument(req, resp);
Writer out = resp.getWriter();
xformer.transform(new DOMSource(doc), new StreamResult(out));
}
}
}
12.6. UI Tutorial
The permissions UI provides reusable components for building customized permission administration
interfaces.
The default implementation of it resides under /permissions/. It supports a standard set of permis-
sions: READ, WRITE, CREATE, DELETE, ADMIN. A user or group with admin privilege on an
object can share the privileges with other parties using this interface.
There are two requirements to show an object’s permission tables.
The viewing user must be authenticated by having logged so that the user ID can be read from the
user cookie.
The ACSObject ID must be in the page state as a global parameter (current implementation to
support URL redirects and URL referencing in WAF Tcl style).
The first step is to create the embedding Bebop Page for the permissions UI. A simple example is Ob-
jectPermissionsPage.java. This only has a UserAuthenticationListener in the construc-
tor and builds a PermissionsPane using the default constructor. Note, that the default constructor
will give you the permissions table with READ, WRITE, CREATE, DELETE, ADMIN privileges
(as defined in PermissionsConstants.java). You can use this to build permissions tables with a
privilege array customized for your application:
PermissionsPane(PrivilegeDescriptor[] privs)
The main class that provides components for the permissions UI is PermissionsPane. It has dual
functionality:
1. It implements the generic permissions UI for ACSObjects,
2. It provides getter methods to retrieve only parts of the interface.
If you use the PermissionsPane class directly, you get a UI layout equivalent to what you see
at http://yourhost.com/permissions/, using with your privileges instead. If you want to use