use of org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.TestACL in project jackrabbit-oak by apache.
the class AccessControlManagerImplTest method testSetInvalidPolicy.
@Test
public void testSetInvalidPolicy() throws Exception {
try {
acMgr.setPolicy(testPath, new TestACL(testPath, getRestrictionProvider(), getNamePathMapper()));
fail("Setting invalid policy must fail");
} catch (AccessControlException e) {
// success
}
ACL acl = setupPolicy(testPath);
try {
acMgr.setPolicy(testPath, new TestACL(testPath, getRestrictionProvider(), getNamePathMapper()));
fail("Setting invalid policy must fail");
} catch (AccessControlException e) {
// success
}
ACL repoAcl = setupPolicy(null);
try {
acMgr.setPolicy(testPath, repoAcl);
fail("Setting invalid policy must fail");
} catch (AccessControlException e) {
// success
}
try {
acMgr.setPolicy(null, acl);
fail("Setting invalid policy must fail");
} catch (AccessControlException e) {
// success
}
}
use of org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.TestACL in project jackrabbit-oak by apache.
the class AccessControlManagerImplTest method testRemoveInvalidPolicy.
@Test
public void testRemoveInvalidPolicy() throws Exception {
ACL acl = setupPolicy(testPath);
try {
acMgr.removePolicy(testPath, new TestACL(testPath, getRestrictionProvider(), getNamePathMapper()));
fail("Invalid policy -> removal must fail");
} catch (AccessControlException e) {
// success
}
ACL repoAcl = setupPolicy(null);
try {
acMgr.removePolicy(testPath, repoAcl);
fail("Setting invalid policy must fail");
} catch (AccessControlException e) {
// success
}
try {
acMgr.removePolicy(null, acl);
fail("Setting invalid policy must fail");
} catch (AccessControlException e) {
// success
}
}
Aggregations