use of javax.jcr.security.AccessControlManager in project jackrabbit-oak by apache.
the class CugContextTest method before.
@Before
@Override
public void before() throws Exception {
super.before();
// add more child nodes
NodeUtil n = new NodeUtil(root.getTree(SUPPORTED_PATH));
n.addChild("a", NT_OAK_UNSTRUCTURED).addChild("b", NT_OAK_UNSTRUCTURED).addChild("c", NT_OAK_UNSTRUCTURED);
n.addChild("aa", NT_OAK_UNSTRUCTURED).addChild("bb", NT_OAK_UNSTRUCTURED).addChild("cc", NT_OAK_UNSTRUCTURED);
// create cugs
createCug("/content/a", getTestUser().getPrincipal());
// setup regular acl at /content
AccessControlManager acMgr = getAccessControlManager(root);
AccessControlList acl = AccessControlUtils.getAccessControlList(acMgr, "/content");
acl.addAccessControlEntry(getTestUser().getPrincipal(), privilegesFromNames(PrivilegeConstants.JCR_READ));
acMgr.setPolicy("/content", acl);
root.commit();
}
use of javax.jcr.security.AccessControlManager in project jackrabbit-oak by apache.
the class CugConfigurationTest method testGetAccessControlManagerNoSupportedPaths.
@Test
public void testGetAccessControlManagerNoSupportedPaths() {
CugConfiguration cc = createConfiguration(ConfigurationParameters.of(CugConstants.PARAM_CUG_ENABLED, true));
AccessControlManager acMgr = cc.getAccessControlManager(root, NamePathMapper.DEFAULT);
assertTrue(acMgr instanceof CugAccessControlManager);
}
use of javax.jcr.security.AccessControlManager in project jackrabbit-oak by apache.
the class CugConfigurationTest method testGetAccessControlManagerDisabled.
@Test
public void testGetAccessControlManagerDisabled() {
CugConfiguration cc = createConfiguration(ConfigurationParameters.of(CugConstants.PARAM_CUG_ENABLED, false));
AccessControlManager acMgr = cc.getAccessControlManager(root, NamePathMapper.DEFAULT);
assertTrue(acMgr instanceof CugAccessControlManager);
}
use of javax.jcr.security.AccessControlManager in project jackrabbit-oak by apache.
the class CompositeAccessControlManager method getEffectivePolicies.
@Override
public AccessControlPolicy[] getEffectivePolicies(String absPath) throws RepositoryException {
ImmutableList.Builder<AccessControlPolicy> privs = ImmutableList.builder();
for (AccessControlManager acMgr : acMgrs) {
privs.add(acMgr.getEffectivePolicies(absPath));
}
List<AccessControlPolicy> l = privs.build();
return l.toArray(new AccessControlPolicy[l.size()]);
}
use of javax.jcr.security.AccessControlManager in project jackrabbit-oak by apache.
the class CompositeAccessControlManager method getPolicies.
@Override
public JackrabbitAccessControlPolicy[] getPolicies(Principal principal) throws RepositoryException {
ImmutableList.Builder<JackrabbitAccessControlPolicy> privs = ImmutableList.builder();
for (AccessControlManager acMgr : acMgrs) {
if (acMgr instanceof JackrabbitAccessControlManager) {
privs.add(((JackrabbitAccessControlManager) acMgr).getPolicies(principal));
}
}
List<JackrabbitAccessControlPolicy> l = privs.build();
return l.toArray(new JackrabbitAccessControlPolicy[l.size()]);
}
Aggregations