use of javax.jcr.security.AccessControlPolicyIterator in project jackrabbit-oak by apache.
the class AccessControlManagerImplTest method testGetApplicablePoliciesForAccessControlled.
@Test
public void testGetApplicablePoliciesForAccessControlled() throws Exception {
AccessControlPolicy policy = getApplicablePolicy(testPath);
acMgr.setPolicy(testPath, policy);
AccessControlPolicyIterator itr = acMgr.getApplicablePolicies(testPath);
assertNotNull(itr);
assertFalse(itr.hasNext());
}
use of javax.jcr.security.AccessControlPolicyIterator in project jackrabbit-oak by apache.
the class AccessControlManagerImplTest method testGetApplicablePoliciesOnAccessControllable.
@Test
public void testGetApplicablePoliciesOnAccessControllable() throws Exception {
NodeUtil node = new NodeUtil(root.getTree(testPath));
node.setNames(JcrConstants.JCR_MIXINTYPES, MIX_REP_ACCESS_CONTROLLABLE);
AccessControlPolicyIterator itr = acMgr.getApplicablePolicies(testPath);
assertNotNull(itr);
assertTrue(itr.hasNext());
}
use of javax.jcr.security.AccessControlPolicyIterator in project jackrabbit-oak by apache.
the class AccessControlManagerImplTest method testGetApplicablePoliciesWithCollidingNode.
@Test
public void testGetApplicablePoliciesWithCollidingNode() throws Exception {
NodeUtil testTree = new NodeUtil(root.getTree(testPath));
testTree.addChild(REP_POLICY, JcrConstants.NT_UNSTRUCTURED);
AccessControlPolicyIterator itr = acMgr.getApplicablePolicies(testPath);
assertNotNull(itr);
assertFalse(itr.hasNext());
}
use of javax.jcr.security.AccessControlPolicyIterator in project jackrabbit-oak by apache.
the class L2_AccessControlManagerTest method testRetrievePoliciesAtNamespaceRoot.
public void testRetrievePoliciesAtNamespaceRoot() throws RepositoryException {
AccessControlPolicy[] policies = acMgr.getPolicies(NamespaceConstants.NAMESPACES_PATH);
// EXERCISE
int expectedLength = -1;
assertEquals(expectedLength, policies.length);
AccessControlPolicyIterator policyIterator = acMgr.getApplicablePolicies(NamespaceConstants.NAMESPACES_PATH);
// EXERCISE
int expectedSize = -1;
assertEquals(expectedSize, policyIterator.getSize());
// EXERCISE: look at the utility methods and explain the expected return value
JackrabbitAccessControlList acl = AccessControlUtils.getAccessControlList(acMgr, NamespaceConstants.NAMESPACES_PATH);
JackrabbitAccessControlList acl2 = AccessControlUtils.getAccessControlList(superuser, NamespaceConstants.NAMESPACES_PATH);
// EXERCISE: is this correct?
assertEquals(acl, acl2);
}
use of javax.jcr.security.AccessControlPolicyIterator in project jackrabbit-oak by apache.
the class JackrabbitAccessControlListTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
Node n = testRootNode.addNode(nodeName1, testNodeType);
superuser.save();
AccessControlPolicyIterator it = acMgr.getApplicablePolicies(n.getPath());
while (it.hasNext() && acl == null) {
AccessControlPolicy p = it.nextAccessControlPolicy();
if (p instanceof JackrabbitAccessControlList) {
acl = (JackrabbitAccessControlList) p;
}
}
if (acl == null) {
superuser.logout();
throw new NotExecutableException("No JackrabbitAccessControlList to test.");
}
testPrincipal = getValidPrincipal();
testPrivileges = privilegesFromName(Privilege.JCR_ALL);
}
Aggregations