use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.Restriction 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.Restriction in project jackrabbit-oak by apache.
the class EntryTest method testGetRestrictions.
@Test
public void testGetRestrictions() throws Exception {
Restriction nameRestr = createRestriction(AccessControlConstants.REP_NT_NAMES, nameValues);
Restriction globRestr = createRestriction(AccessControlConstants.REP_GLOB, globValue);
Set<Restriction> expected = ImmutableSet.of(nameRestr, globRestr);
ACE ace = createEntry(expected);
assertEquals(expected, ace.getRestrictions());
}
use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.Restriction in project jackrabbit-oak by apache.
the class EntryTest method testGetRestrictionForEmpty.
@Test
public void testGetRestrictionForEmpty() throws Exception {
// empty restrictions
Value val = createEntry(Collections.<Restriction>emptySet()).getRestriction(AccessControlConstants.REP_GLOB);
assertNull(val);
}
use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.Restriction in project jackrabbit-oak by apache.
the class EntryTest method testGetNonExistingRestriction.
@Test
public void testGetNonExistingRestriction() throws Exception {
// single valued restriction
Restriction globRestr = createRestriction(AccessControlConstants.REP_GLOB, globValue);
ACE ace = createEntry(ImmutableSet.of(globRestr));
assertNull(ace.getRestriction(AccessControlConstants.REP_NT_NAMES));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.Restriction in project jackrabbit-oak by apache.
the class EntryTest method testGetRestrictionForSingleValued.
@Test
public void testGetRestrictionForSingleValued() throws Exception {
// single valued restriction
Restriction globRestr = createRestriction(AccessControlConstants.REP_GLOB, globValue);
ACE ace = createEntry(ImmutableSet.of(globRestr));
Value val = ace.getRestriction(AccessControlConstants.REP_GLOB);
assertNotNull(val);
assertEquals(globValue, val);
}
Aggregations