permissions.clear();
Enumeration aclList = security.enumeratePermissions(this.slideToken,
current);
while (aclList.hasMoreElements()) {
NodePermission permission = (NodePermission) aclList.nextElement();
// if we are processing inheritedPermissions (from parent and up)
// then the permission should be inheritable
if (inheritedPermissions &&
!permission.isInheritable()) {
// continue with next permission
continue;
}
permissions.add(permission);
}
// start combining and writing the permissions
while (permissions.size()>0) {
NodePermission permission = (NodePermission) permissions.get(0);
permissions.remove(0);
String principal = permission.getSubjectUri();
boolean negative = permission.isNegative();
String action = permission.getActionUri();
// read
boolean isReadObject = readObjectUri.startsWith(action);
boolean isReadLocks = readLocksUri.startsWith(action);
boolean isReadRevisionMetadata = readRevisionMetadataUri.startsWith(action);
boolean isReadRevisionContent = readRevisionContentUri.startsWith(action);
// write
boolean isCreateObject = createObjectUri.startsWith(action);
boolean isRemoveObject = removeObjectUri.startsWith(action);
boolean isLockObject = lockObjectUri.startsWith(action);
boolean isCreateRevisionMetadata = createRevisionMetadataUri.startsWith(action);
boolean isModifyRevisionMetadata = modifyRevisionMetadataUri.startsWith(action);
boolean isRemoveRevisionMetadata = removeRevisionMetadataUri.startsWith(action);
boolean isCreateRevisionContent = createRevisionContentUri.startsWith(action);
boolean isModifyRevisionContent = modifyRevisionContentUri.startsWith(action);
boolean isRemoveRevisionContent = removeRevisionContentUri.startsWith(action);
// read-acl
boolean isReadPermissions = readPermissionsUri.startsWith(action);
// write-acl
boolean isGrantPermission = grantPermissionUri.startsWith(action);
boolean isRevokePermission = revokePermissionUri.startsWith(action);
// check the other permissions to combine them
// (if they are for the same principal/negative)
for (int i = 0; i<permissions.size(); i++) {
NodePermission otherPermission = (NodePermission) permissions.get(i);
if (principal.equals(otherPermission.getSubjectUri()) &&
(negative==otherPermission.isNegative())) {
permissions.remove(i);
i--; // because we removed the current one
action = otherPermission.getActionUri();
// read
isReadObject |= readObjectUri.startsWith(action);
isReadLocks |= readLocksUri.startsWith(action);
isReadRevisionMetadata |= readRevisionMetadataUri.startsWith(action);