public XMLValue computeGroupMembership(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String contextPath, String servletPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException {
if (revisionDescriptor.getProperty(P_GROUP_MEMBERSHIP) != null) {
Object v = revisionDescriptor.getProperty(P_GROUP_MEMBERSHIP).getValue();
return (v instanceof XMLValue)
? (XMLValue)v
: new XMLValue((String)v);
}
else {
XMLValue xmlValue = new XMLValue();
Uri principalUri = nsaToken.getUri(sToken, revisionDescriptors.getUri());
SubjectNode principalNode = (SubjectNode)principalUri.getStore().retrieveObject(principalUri);
Enumeration roles = ((ACLSecurityImpl)nsaToken.getSecurityHelper()).getGroupMembership(sToken, principalNode);
while (roles.hasMoreElements()) {
String rolePath = (String)roles.nextElement();
// FIXME wihtout servletPath??
String roleHref = contextPath+rolePath;
xmlValue.addHref(roleHref);
}
return xmlValue;
}
}