use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class CugEvaluationTest method testHasPrivilegesTestGroup.
@Test
public void testHasPrivilegesTestGroup() throws Exception {
// testGroup
PermissionProvider pp = createPermissionProvider(testGroupPrincipal);
assertTrue(pp.hasPrivileges(content, PrivilegeConstants.JCR_READ));
assertTrue(pp.hasPrivileges(a, PrivilegeConstants.JCR_READ));
assertFalse(pp.hasPrivileges(c, PrivilegeConstants.JCR_READ));
assertTrue(pp.hasPrivileges(content, PrivilegeConstants.REP_WRITE, PrivilegeConstants.JCR_READ_ACCESS_CONTROL));
assertTrue(pp.hasPrivileges(a, PrivilegeConstants.REP_WRITE, PrivilegeConstants.JCR_READ_ACCESS_CONTROL));
assertTrue(pp.hasPrivileges(c, PrivilegeConstants.REP_WRITE, PrivilegeConstants.JCR_READ_ACCESS_CONTROL));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class CugEvaluationTest method testHasPrivilegesEveryone.
@Test
public void testHasPrivilegesEveryone() throws Exception {
// everyone
PermissionProvider pp = createPermissionProvider(EveryonePrincipal.getInstance());
assertFalse(pp.hasPrivileges(content, PrivilegeConstants.JCR_READ));
assertFalse(pp.hasPrivileges(content2, PrivilegeConstants.JCR_READ));
assertFalse(pp.hasPrivileges(a, PrivilegeConstants.JCR_READ));
assertFalse(pp.hasPrivileges(c, PrivilegeConstants.JCR_READ));
assertFalse(pp.hasPrivileges(content, PrivilegeConstants.REP_WRITE, PrivilegeConstants.JCR_READ_ACCESS_CONTROL));
assertFalse(pp.hasPrivileges(content2, PrivilegeConstants.REP_WRITE, PrivilegeConstants.JCR_READ_ACCESS_CONTROL));
assertFalse(pp.hasPrivileges(a, PrivilegeConstants.REP_WRITE, PrivilegeConstants.JCR_READ_ACCESS_CONTROL));
assertFalse(pp.hasPrivileges(c, PrivilegeConstants.REP_WRITE, PrivilegeConstants.JCR_READ_ACCESS_CONTROL));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class CugEvaluationTest method testHasPrivilegesTestUserEveryone.
@Test
public void testHasPrivilegesTestUserEveryone() throws Exception {
// testUser + everyone
PermissionProvider pp = createPermissionProvider(getTestUser().getPrincipal(), EveryonePrincipal.getInstance());
assertTrue(pp.hasPrivileges(content, PrivilegeConstants.JCR_READ));
assertFalse(pp.hasPrivileges(a, PrivilegeConstants.JCR_READ));
assertTrue(pp.hasPrivileges(c, PrivilegeConstants.JCR_READ));
assertFalse(pp.hasPrivileges(content, PrivilegeConstants.REP_WRITE, PrivilegeConstants.JCR_READ_ACCESS_CONTROL));
assertFalse(pp.hasPrivileges(a, PrivilegeConstants.REP_WRITE, PrivilegeConstants.JCR_READ_ACCESS_CONTROL));
assertFalse(pp.hasPrivileges(c, PrivilegeConstants.REP_WRITE, PrivilegeConstants.JCR_READ_ACCESS_CONTROL));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class CugEvaluationTest method testHasAllPrivileges.
@Test
public void testHasAllPrivileges() throws Exception {
// testGroup
PermissionProvider pp = createPermissionProvider(testGroupPrincipal);
assertFalse(pp.hasPrivileges(content, PrivilegeConstants.JCR_ALL));
assertFalse(pp.hasPrivileges(a, PrivilegeConstants.JCR_ALL));
assertFalse(pp.hasPrivileges(c, PrivilegeConstants.JCR_ALL));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class CugConfigurationTest method testGetPermissionProviderNoSupportedPaths.
@Test
public void testGetPermissionProviderNoSupportedPaths() {
// enabled but no supported paths specified
CugConfiguration cc = createConfiguration(ConfigurationParameters.of(CugConstants.PARAM_CUG_ENABLED, true));
PermissionProvider pp = cc.getPermissionProvider(root, "default", ImmutableSet.<Principal>of(EveryonePrincipal.getInstance()));
assertSame(EmptyPermissionProvider.getInstance(), pp);
}
Aggregations