use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class CugImportBaseTest method testCugValidPrincipals.
@Test
public void testCugValidPrincipals() throws Exception {
testGroup = ((JackrabbitSession) adminSession).getUserManager().createGroup(new PrincipalImpl(TEST_GROUP_PRINCIPAL_NAME));
adminSession.save();
Node targetNode = getTargetNode();
targetNode.addMixin(CugConstants.MIX_REP_CUG_MIXIN);
doImport(getTargetPath(), XML_CUG_POLICY);
adminSession.save();
}
use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class CugPolicyImplTest method testAddInvalidPrincipalsBestEffort.
@Test
public void testAddInvalidPrincipalsBestEffort() throws Exception {
CugPolicy cug = new CugPolicyImpl(path, NamePathMapper.DEFAULT, principalManager, ImportBehavior.BESTEFFORT, principals);
assertTrue(cug.addPrincipals(EveryonePrincipal.getInstance(), new PrincipalImpl("unknown")));
Set<Principal> principalSet = cug.getPrincipals();
assertEquals(3, principalSet.size());
}
use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class CugPolicyImplTest method testRemovePrincipals.
@Test
public void testRemovePrincipals() throws Exception {
CugPolicy cug = new CugPolicyImpl(path, NamePathMapper.DEFAULT, principalManager, ImportBehavior.BESTEFFORT, ImmutableSet.of(testPrincipal, EveryonePrincipal.getInstance()));
assertFalse(cug.removePrincipals(new PrincipalImpl("unknown")));
assertTrue(cug.removePrincipals(testPrincipal, EveryonePrincipal.getInstance(), new PrincipalImpl("unknown")));
assertTrue(cug.getPrincipals().isEmpty());
}
use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class CugPolicyImplTest method testAddEmptyPrincipalName.
@Test(expected = AccessControlException.class)
public void testAddEmptyPrincipalName() throws Exception {
CugPolicy cug = new CugPolicyImpl(path, NamePathMapper.DEFAULT, principalManager, ImportBehavior.BESTEFFORT);
cug.addPrincipals(new PrincipalImpl(""));
}
use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl in project jackrabbit-oak by apache.
the class CugPolicyImplTest method testAddInvalidPrincipalsAbort.
@Test(expected = AccessControlException.class)
public void testAddInvalidPrincipalsAbort() throws Exception {
CugPolicy cug = new CugPolicyImpl(path, NamePathMapper.DEFAULT, principalManager, ImportBehavior.ABORT);
cug.addPrincipals(EveryonePrincipal.getInstance(), new PrincipalImpl("unknown"));
}
Aggregations