throws PathNotFoundException, AccessDeniedException, RepositoryException {
if (session.isReadOnly()) {
throw new AccessDeniedException(JcrI18n.permissionDenied.text(absPath, "read access control content"));
}
JcrAccessControlList acl = getApplicableACL(absPath);
if (!acl.isEmpty()
&& !acl.hasPrivileges(securityContext(), new Privilege[] {privileges.forName(Privilege.JCR_READ_ACCESS_CONTROL)})) {
throw new AccessDeniedException();
}
CachedNode node = session.cachedNode(session.pathFactory().create(absPath), false);
if (node.hasACL(session.cache())) {
// we only support 1 ACL per node; therefore if the node already has an ACL, we don't want to allow any additional
// ones
return AccessControlPolicyIteratorImpl.EMPTY;
}
// the node doesn't have an ACL yet, so return a new, empty ACL which can be used by clients to set privileges
return new AccessControlPolicyIteratorImpl(new JcrAccessControlList(this, absPath));
}