use of javax.jcr.security.AccessControlPolicyIterator in project kylo by Teradata.
the class JcrAccessControlUtil method getAccessControlList.
private static AccessControlList getAccessControlList(String path, AccessControlManager acm) throws PathNotFoundException, AccessDeniedException, RepositoryException {
AccessControlList acl = null;
AccessControlPolicyIterator it = acm.getApplicablePolicies(path);
if (it.hasNext()) {
acl = (AccessControlList) it.nextAccessControlPolicy();
} else {
acl = (AccessControlList) acm.getPolicies(path)[0];
}
return acl;
}
use of javax.jcr.security.AccessControlPolicyIterator in project pentaho-platform by pentaho.
the class JcrRepositoryFileAclUtils method getAccessControlList.
private static AccessControlList getAccessControlList(final AccessControlManager acMgr, final String path) throws RepositoryException {
AccessControlPolicyIterator applicablePolicies = acMgr.getApplicablePolicies(path);
while (applicablePolicies.hasNext()) {
AccessControlPolicy policy = applicablePolicies.nextAccessControlPolicy();
if (policy instanceof AccessControlList) {
return (AccessControlList) policy;
}
}
AccessControlPolicy[] policies = acMgr.getPolicies(path);
for (int i = 0; i < policies.length; i++) {
if (policies[i] instanceof AccessControlList) {
return (AccessControlList) policies[i];
}
}
throw new IllegalStateException("no access control list applies or is bound to node");
}
use of javax.jcr.security.AccessControlPolicyIterator in project jackrabbit-oak by apache.
the class AbstractCugTest method createCug.
void createCug(@Nonnull String absPath, @Nonnull Principal principal) throws RepositoryException {
AccessControlManager acMgr = getAccessControlManager(root);
AccessControlPolicyIterator it = acMgr.getApplicablePolicies(absPath);
while (it.hasNext()) {
AccessControlPolicy policy = it.nextAccessControlPolicy();
if (policy instanceof CugPolicy) {
((CugPolicy) policy).addPrincipals(principal);
acMgr.setPolicy(absPath, policy);
return;
}
}
throw new IllegalStateException("Unable to create CUG at " + absPath);
}
use of javax.jcr.security.AccessControlPolicyIterator in project jackrabbit-oak by apache.
the class CugAccessControlManagerTest method testGetApplicablePoliciesAfterSet.
@Test
public void testGetApplicablePoliciesAfterSet() throws Exception {
cugAccessControlManager.setPolicy(SUPPORTED_PATH, getApplicableCug(SUPPORTED_PATH));
AccessControlPolicyIterator it = cugAccessControlManager.getApplicablePolicies(SUPPORTED_PATH);
assertFalse(it.hasNext());
}
use of javax.jcr.security.AccessControlPolicyIterator in project jackrabbit-oak by apache.
the class CugAccessControlManagerTest method testGetApplicablePoliciesNullPath.
@Test
public void testGetApplicablePoliciesNullPath() throws Exception {
AccessControlPolicyIterator it = cugAccessControlManager.getApplicablePolicies((String) null);
assertFalse(it.hasNext());
}
Aggregations