use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class CugConfigurationTest method testExcludedPrincipals.
@Test
public void testExcludedPrincipals() {
ConfigurationParameters params = ConfigurationParameters.of(CugConstants.PARAM_CUG_ENABLED, true, CugConstants.PARAM_CUG_SUPPORTED_PATHS, "/content");
CugConfiguration cc = createConfiguration(params);
List<Principal> excluded = ImmutableList.of(SystemPrincipal.INSTANCE, new AdminPrincipal() {
@Override
public String getName() {
return "admin";
}
}, new SystemUserPrincipal() {
@Override
public String getName() {
return "systemUser";
}
});
for (Principal p : excluded) {
Set<Principal> principals = ImmutableSet.of(p, EveryonePrincipal.getInstance());
PermissionProvider pp = cc.getPermissionProvider(root, "default", principals);
assertSame(EmptyPermissionProvider.getInstance(), pp);
}
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class CugConfigurationTest method testGetPermissionProviderDisabled3.
@Test
public void testGetPermissionProviderDisabled3() {
CugConfiguration cc = createConfiguration(ConfigurationParameters.EMPTY);
PermissionProvider pp = cc.getPermissionProvider(root, "default", ImmutableSet.<Principal>of(EveryonePrincipal.getInstance()));
assertSame(EmptyPermissionProvider.getInstance(), pp);
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class CugEvaluationTest method testGetPrivilegesTestGroup.
@Test
public void testGetPrivilegesTestGroup() throws Exception {
Set<String> w_rac = ImmutableSet.of(PrivilegeConstants.REP_WRITE, PrivilegeConstants.JCR_READ_ACCESS_CONTROL);
Set<String> r_w_rac = ImmutableSet.of(PrivilegeConstants.JCR_READ, PrivilegeConstants.REP_WRITE, PrivilegeConstants.JCR_READ_ACCESS_CONTROL);
// testGroup
PermissionProvider pp = createPermissionProvider(testGroupPrincipal);
assertEquals(r_w_rac, pp.getPrivileges(content));
assertEquals(r_w_rac, pp.getPrivileges(a));
assertEquals(w_rac, pp.getPrivileges(c));
assertTrue(pp.getPrivileges(content2).isEmpty());
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class CugEvaluationTest method testGetPrivilegesTestGroupEveryone.
@Test
public void testGetPrivilegesTestGroupEveryone() throws Exception {
Set<String> r_w_rac = ImmutableSet.of(PrivilegeConstants.JCR_READ, PrivilegeConstants.REP_WRITE, PrivilegeConstants.JCR_READ_ACCESS_CONTROL);
// testGroup + everyone
PermissionProvider pp = createPermissionProvider(testGroupPrincipal, EveryonePrincipal.getInstance());
assertEquals(r_w_rac, pp.getPrivileges(content));
assertEquals(r_w_rac, pp.getPrivileges(a));
assertEquals(r_w_rac, pp.getPrivileges(c));
assertTrue(pp.getPrivileges(content2).isEmpty());
}
use of org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider in project jackrabbit-oak by apache.
the class CugConfigurationTest method testGetPermissionProviderDisabled2.
@Test
public void testGetPermissionProviderDisabled2() {
ConfigurationParameters params = ConfigurationParameters.of(CugConstants.PARAM_CUG_ENABLED, false, CugConstants.PARAM_CUG_SUPPORTED_PATHS, "/content");
CugConfiguration cc = createConfiguration(params);
PermissionProvider pp = cc.getPermissionProvider(root, "default", ImmutableSet.<Principal>of(EveryonePrincipal.getInstance()));
assertSame(EmptyPermissionProvider.getInstance(), pp);
}
Aggregations