use of javax.jcr.security.AccessControlPolicyIterator in project jackrabbit by apache.
the class ACLEditorTest method testNodeNotRepAccessControllable.
public void testNodeNotRepAccessControllable() throws RepositoryException, LockException, ConstraintViolationException, NoSuchNodeTypeException, ItemExistsException, VersionException {
AccessControlPolicy[] plcs = acMgr.getPolicies(testPath);
assertNotNull(plcs);
assertEquals(0, plcs.length);
AccessControlPolicyIterator it = acMgr.getApplicablePolicies(testPath);
assertNotNull(it);
assertEquals(0, it.getSize());
}
use of javax.jcr.security.AccessControlPolicyIterator in project jackrabbit by apache.
the class AccessControlPolicyIteratorTest method testGetSize.
public void testGetSize() throws RepositoryException, AccessDeniedException, NotExecutableException {
checkCanReadAc(path);
AccessControlPolicyIterator it = acMgr.getApplicablePolicies(path);
// get size must succeed. its value however is indefined.
long size = it.getSize();
assertTrue("Size must be -1 or any value >= 0", size == -1 || size >= 0);
}
use of javax.jcr.security.AccessControlPolicyIterator in project jackrabbit by apache.
the class AccessControlPolicyIteratorTest method testGetInitialPosition.
public void testGetInitialPosition() throws RepositoryException, AccessDeniedException, NotExecutableException {
checkCanReadAc(path);
AccessControlPolicyIterator it = acMgr.getApplicablePolicies(path);
// the initial position of the policy iterator must be 0.
assertTrue("Initial position of AccessControlPolicyIterator must be 0.", it.getPosition() == 0);
}
use of javax.jcr.security.AccessControlPolicyIterator in project jackrabbit by apache.
the class AccessControlPolicyTest method testNodeIsModifiedAfterSetPolicy.
public void testNodeIsModifiedAfterSetPolicy() throws RepositoryException, AccessDeniedException, NotExecutableException {
checkCanModifyAc(path);
AccessControlPolicyIterator it = acMgr.getApplicablePolicies(path);
if (it.hasNext()) {
Item item = superuser.getItem(path);
AccessControlPolicy policy = it.nextAccessControlPolicy();
acMgr.setPolicy(path, policy);
assertTrue("After setting a policy the node must be marked modified.", item.isModified());
} else {
throw new NotExecutableException();
}
}
use of javax.jcr.security.AccessControlPolicyIterator in project jackrabbit by apache.
the class AccessControlPolicyTest method testSetPolicyOnNewNode.
public void testSetPolicyOnNewNode() throws NotExecutableException, RepositoryException, AccessDeniedException {
Node n;
try {
n = ((Node) superuser.getItem(path)).addNode(nodeName2, testNodeType);
} catch (RepositoryException e) {
throw new NotExecutableException();
}
AccessControlPolicyIterator it = acMgr.getApplicablePolicies(n.getPath());
while (it.hasNext()) {
AccessControlPolicy policy = it.nextAccessControlPolicy();
acMgr.setPolicy(n.getPath(), policy);
AccessControlPolicy[] plcs = acMgr.getPolicies(n.getPath());
assertNotNull("After calling setPolicy the manager must return a non-null policy array for the new Node.", plcs);
assertTrue("After calling setPolicy the manager must return a policy array with a length greater than zero for the new Node.", plcs.length > 0);
}
}
Aggregations