use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.Restriction in project jackrabbit-oak by apache.
the class ACETest method testGetRestrictionNames.
@Test
public void testGetRestrictionNames() throws Exception {
// empty restrictions
String[] restrictionNames = createEntry().getRestrictionNames();
assertNotNull(restrictionNames);
assertEquals(0, restrictionNames.length);
Restriction globRestr = createRestriction(AccessControlConstants.REP_GLOB, globValue);
Restriction nameRestr = createRestriction(AccessControlConstants.REP_NT_NAMES, nameValues);
// single restriction
restrictionNames = createEntry(globRestr).getRestrictionNames();
assertEquals(1, restrictionNames.length);
// 2 restrictions
restrictionNames = createEntry(globRestr, nameRestr).getRestrictionNames();
assertEquals(2, restrictionNames.length);
}
use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.Restriction in project jackrabbit-oak by apache.
the class ACETest method testGetNonExistingRestrictions.
/**
* @since OAK 1.0: support for multi-value restrictions
*/
@Test
public void testGetNonExistingRestrictions() throws Exception {
Restriction nameRestr = createRestriction(AccessControlConstants.REP_NT_NAMES, nameValues);
ACE ace = createEntry(nameRestr);
assertNull(ace.getRestrictions(AccessControlConstants.REP_GLOB));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.Restriction in project jackrabbit-oak by apache.
the class ACETest 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(nameRestr, globRestr);
assertEquals(expected, ace.getRestrictions());
}
use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.Restriction in project jackrabbit-oak by apache.
the class ACETest method testGetRestrictionsForSingleValue.
/**
* @since OAK 1.0: support for multi-value restrictions
*/
@Test
public void testGetRestrictionsForSingleValue() throws Exception {
// single valued restriction
Restriction globRestr = createRestriction(AccessControlConstants.REP_GLOB, globValue);
ACE ace = createEntry(globRestr);
Value[] vs = ace.getRestrictions(AccessControlConstants.REP_GLOB);
assertNotNull(vs);
assertArrayEquals(new Value[] { globValue }, vs);
}
use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.Restriction in project jackrabbit-oak by apache.
the class ACETest method testGetRestrictionForMultiValued2.
/**
* @since OAK 1.0: support for multi-value restrictions
*/
@Test
public void testGetRestrictionForMultiValued2() throws Exception {
// single value restriction stored in multi-value property
Restriction singleNameRestr = createRestriction(AccessControlConstants.REP_NT_NAMES, new Value[] { nameValue });
ACE ace = createEntry(singleNameRestr);
Value val = ace.getRestriction(AccessControlConstants.REP_NT_NAMES);
assertEquals(nameValue, val);
}
Aggregations