use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionImpl in project jackrabbit-oak by apache.
the class PrincipalRestrictionProvider method readRestrictions.
@Nonnull
@Override
public Set<Restriction> readRestrictions(@Nullable String oakPath, @Nonnull Tree aceTree) {
Set<Restriction> restrictions = new HashSet<Restriction>(base.readRestrictions(oakPath, aceTree));
String value = (oakPath == null) ? "" : oakPath;
PropertyState nodePathProp = PropertyStates.createProperty(REP_NODE_PATH, value, Type.PATH);
restrictions.add(new RestrictionImpl(nodePathProp, true));
return restrictions;
}
use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionImpl in project jackrabbit-oak by apache.
the class CompositeRestrictionProviderTest method testWriteUnsupportedRestrictions.
@Test
public void testWriteUnsupportedRestrictions() throws Exception {
NodeUtil aceNode = new NodeUtil(root.getTree("/")).addChild("test", NT_REP_GRANT_ACE);
Restriction invalid = new RestrictionImpl(PropertyStates.createProperty("invalid", vf.createValue(true)), false);
try {
provider.writeRestrictions("/test", aceNode.getTree(), ImmutableSet.<Restriction>of(invalid));
fail("AccessControlException expected");
} catch (AccessControlException e) {
// success
}
}
use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionImpl in project jackrabbit-oak by apache.
the class AbstractRestrictionProviderTest method testWriteInvalidRestrictions.
@Test
public void testWriteInvalidRestrictions() throws Exception {
PropertyState ps = PropertyStates.createProperty(REP_GLOB, valueFactory.createValue(false));
Tree aceTree = getAceTree();
restrictionProvider.writeRestrictions(testPath, aceTree, ImmutableSet.<Restriction>of(new RestrictionImpl(ps, false)));
assertTrue(aceTree.hasChild(REP_RESTRICTIONS));
Tree restr = aceTree.getChild(REP_RESTRICTIONS);
assertEquals(ps, restr.getProperty(REP_GLOB));
}
Aggregations