use of javax.jcr.security.AccessControlException in project jackrabbit-oak by apache.
the class AccessControlManagerImplTest method testGetPoliciesInvalidPrincipal.
@Test
public void testGetPoliciesInvalidPrincipal() throws Exception {
Principal unknown = getPrincipalManager(root).getPrincipal("unknown");
int i = 0;
while (unknown != null) {
unknown = getPrincipalManager(root).getPrincipal("unknown" + i);
}
unknown = new InvalidTestPrincipal("unknown" + i);
try {
acMgr.getPolicies(unknown);
fail("Unknown principal should be detected.");
} catch (AccessControlException e) {
// success
}
}
use of javax.jcr.security.AccessControlException in project jackrabbit-oak by apache.
the class AbstractRestrictionProviderTest method testValidateRestrictionsMissingMandatory.
@Test
public void testValidateRestrictionsMissingMandatory() throws Exception {
Restriction glob = restrictionProvider.createRestriction(testPath, REP_GLOB, globValue);
try {
restrictionProvider.validateRestrictions(testPath, getAceTree(glob));
fail("missing mandatory restriction");
} catch (AccessControlException e) {
// success
}
}
use of javax.jcr.security.AccessControlException in project jackrabbit-oak by apache.
the class AbstractRestrictionProviderTest method testValidateRestrictionsUnsupportedPath.
@Test
public void testValidateRestrictionsUnsupportedPath() throws Exception {
// empty restrictions => must succeed
restrictionProvider.validateRestrictions(null, getAceTree());
// non-empty restrictions => must fail
try {
Restriction restr = restrictionProvider.createRestriction(testPath, REP_GLOB, globValue);
restrictionProvider.validateRestrictions(null, getAceTree(restr));
fail();
} catch (AccessControlException e) {
// success
}
}
use of javax.jcr.security.AccessControlException in project jackrabbit-oak by apache.
the class AbstractRestrictionProviderTest method testValidateRestrictionsWrongType.
@Test
public void testValidateRestrictionsWrongType() throws Exception {
Restriction mand = restrictionProvider.createRestriction(testPath, "mandatory", valueFactory.createValue(true));
try {
Tree ace = getAceTree(mand);
new NodeUtil(ace).getChild(REP_RESTRICTIONS).setBoolean(REP_GLOB, true);
restrictionProvider.validateRestrictions(testPath, ace);
fail("wrong type with restriction 'rep:glob");
} catch (AccessControlException e) {
// success
}
}
use of javax.jcr.security.AccessControlException in project jackrabbit-oak by apache.
the class AbstractRestrictionProviderTest method testValidateRestrictionsUnsupportedRestriction.
@Test
public void testValidateRestrictionsUnsupportedRestriction() throws Exception {
Restriction mand = restrictionProvider.createRestriction(testPath, "mandatory", valueFactory.createValue(true));
try {
Tree ace = getAceTree(mand);
new NodeUtil(ace).getChild(REP_RESTRICTIONS).setString("Unsupported", "value");
restrictionProvider.validateRestrictions(testPath, ace);
fail("wrong type with restriction 'rep:glob");
} catch (AccessControlException e) {
// success
}
}
Aggregations