Search in sources :

Example 1 with AbstractTree

use of org.apache.jackrabbit.oak.plugins.tree.impl.AbstractTree in project jackrabbit-oak by apache.

the class EmptyCugTreePermissionTest method before.

@Override
public void before() throws Exception {
    super.before();
    createCug(SUPPORTED_PATH, EveryonePrincipal.getInstance());
    root.commit();
    pp = createCugPermissionProvider(ImmutableSet.of(SUPPORTED_PATH, SUPPORTED_PATH2), getTestUser().getPrincipal(), EveryonePrincipal.getInstance());
    Root readOnlyRoot = RootFactory.createReadOnlyRoot(root);
    Tree t = readOnlyRoot.getTree("/");
    tp = new EmptyCugTreePermission(t, TreeType.DEFAULT, pp);
    rootState = ((AbstractTree) t).getNodeState();
}
Also used : Root(org.apache.jackrabbit.oak.api.Root) Tree(org.apache.jackrabbit.oak.api.Tree) AbstractTree(org.apache.jackrabbit.oak.plugins.tree.impl.AbstractTree)

Example 2 with AbstractTree

use of org.apache.jackrabbit.oak.plugins.tree.impl.AbstractTree in project jackrabbit-oak by apache.

the class CugTreePermissionTest method testGetChildPermission.

@Test
public void testGetChildPermission() throws Exception {
    NodeState ns = ((AbstractTree) root.getTree(SUPPORTED_PATH + "/subtree")).getNodeState();
    TreePermission child = allowedTp.getChildPermission("subtree", ns);
    assertTrue(child instanceof CugTreePermission);
    child = deniedTp.getChildPermission("subtree", ns);
    assertTrue(child instanceof CugTreePermission);
    NodeState cugNs = ((AbstractTree) root.getTree(PathUtils.concat(SUPPORTED_PATH, REP_CUG_POLICY))).getNodeState();
    TreePermission cugChild = allowedTp.getChildPermission(REP_CUG_POLICY, cugNs);
    assertSame(TreePermission.NO_RECOURSE, cugChild);
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) AbstractTree(org.apache.jackrabbit.oak.plugins.tree.impl.AbstractTree) TreePermission(org.apache.jackrabbit.oak.spi.security.authorization.permission.TreePermission) Test(org.junit.Test)

Aggregations

AbstractTree (org.apache.jackrabbit.oak.plugins.tree.impl.AbstractTree)2 Root (org.apache.jackrabbit.oak.api.Root)1 Tree (org.apache.jackrabbit.oak.api.Tree)1 TreePermission (org.apache.jackrabbit.oak.spi.security.authorization.permission.TreePermission)1 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)1 Test (org.junit.Test)1