*/
private ItemData initACL(NodeData parent, NodeData node) throws RepositoryException
{
if (node != null)
{
AccessControlList acl = node.getACL();
if (acl == null)
{
if (parent != null)
{
// use parent ACL
node =
new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
node.getParentIdentifier(), parent.getACL());
}
else
{
// use nearest ancestor ACL... case of get by id
node =
new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
node.getParentIdentifier(), getNearestACAncestorAcl(node));
}
}
else if (!acl.hasPermissions())
{
// use nearest ancestor permissions
AccessControlList ancestorAcl = getNearestACAncestorAcl(node);
node =
new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
node.getParentIdentifier(), new AccessControlList(acl.getOwner(), ancestorAcl.getPermissionEntries()));
}
else if (!acl.hasOwner())
{
// use nearest ancestor owner
AccessControlList ancestorAcl = getNearestACAncestorAcl(node);
node =
new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
node.getParentIdentifier(), new AccessControlList(ancestorAcl.getOwner(), acl.getPermissionEntries()));
}
}
return node;