Enumeration aclList = security.enumeratePermissions
(slideToken, current);
while (aclList.hasMoreElements()) {
NodePermission permission = (NodePermission)
aclList.nextElement();
String principal = permission.getSubjectUri();
String action = permission.getActionUri();
// read
boolean isReadObject = readObjectUri.startsWith(action);
boolean isReadRevisionMetadata =
readRevisionMetadataUri.startsWith(action);
boolean isReadRevisionContent =
readRevisionContentUri.startsWith(action);
boolean isRead = isReadObject && isReadRevisionMetadata
&& isReadRevisionContent;
// write
boolean isCreateObject =
createObjectUri.startsWith(action);
boolean isRemoveObject =
removeObjectUri.startsWith(action);
boolean isLockObject = lockObjectUri.startsWith(action);
boolean isReadLocks = readLocksUri.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);
boolean isWrite = isCreateObject && isRemoveObject
&& isLockObject && isReadLocks
&& isCreateRevisionMetadata
&& isModifyRevisionMetadata && isRemoveRevisionMetadata
&& isCreateRevisionContent && isModifyRevisionContent
&& isRemoveRevisionContent;
//read-acl
boolean isReadPermissions =
readPermissionsUri.startsWith(action);
boolean isReadAcl = isReadPermissions;
// write-acl
boolean isGrantPermission =
grantPermissionUri.startsWith(action);
boolean isRevokePermission =
revokePermissionUri.startsWith(action);
boolean isWriteAcl =
isGrantPermission && isRevokePermission;
boolean isAll = isRead && isWrite && isReadAcl
&& isWriteAcl;
generatedXML.writeElement(null, ACE, XMLPrinter.OPENING);
writePrincipal(generatedXML, principal);
if (permission.isNegative()) {
generatedXML.writeElement(null, DENY,
XMLPrinter.OPENING);
} else {
generatedXML.writeElement(null, GRANT,
XMLPrinter.OPENING);
}
if (isAll) {
writePrivilege(generatedXML, "all", true);
} else {
if (isRead) {
writePrivilege(generatedXML, "read", true);
} else {
if (isReadObject)
writePrivilege(generatedXML,
"read-object", false);
if (isReadRevisionMetadata)
writePrivilege(generatedXML,
"read-revision-metadata",
false);
if (isReadRevisionContent)
writePrivilege(generatedXML,
"read-revision-content", false);
}
if (isWrite) {
writePrivilege(generatedXML, "write", true);
} else {
if (isCreateObject)
writePrivilege(generatedXML,
"create-object", false);
if (isRemoveObject)
writePrivilege(generatedXML,
"remove-object", false);
if (isLockObject)
writePrivilege(generatedXML,
"lock-object", false);
if (isReadLocks)
writePrivilege(generatedXML,
"read-locks", false);
if (isCreateRevisionMetadata)
writePrivilege(generatedXML,
"create-revision-metadata",
false);
if (isModifyRevisionMetadata)
writePrivilege(generatedXML,
"modify-revision-metadata",
false);
if (isRemoveRevisionMetadata)
writePrivilege(generatedXML,
"remove-revision-metadata",
false);
if (isCreateRevisionContent)
writePrivilege(generatedXML,
"create-revision-content",
false);
if (isModifyRevisionContent)
writePrivilege(generatedXML,
"modify-revision-content",
false);
if (isRemoveRevisionContent)
writePrivilege(generatedXML,
"remove-revision-content",
false);
}
if (isReadAcl) {
writePrivilege(generatedXML, "read-acl", true);
}
if (isWriteAcl) {
writePrivilege(generatedXML, "write-acl", true);
} else {
if (isGrantPermission)
writePrivilege(generatedXML,
"grant-permission", false);
if (isRevokePermission)
writePrivilege(generatedXML,
"revoke-permission", false);
}
}
if (permission.isNegative()) {
generatedXML.writeElement(null, DENY,
XMLPrinter.CLOSING);
} else {
generatedXML.writeElement(null, GRANT,
XMLPrinter.CLOSING);