RepoPolicyTreePermission implements TreePermission { @Override public boolean canRead() { return getReadStatus().allowsThis(); } RepoPolicyTreePermission(@NotNull RepositoryPermission repoPermission); @NotNull @Override TreePermission getChildPermission(@NotNull String childName, @NotNull NodeState childState); @Override boolean canRead(); @Override boolean canRead(@NotNull PropertyState property); @Override boolean canReadAll(); @Override boolean canReadProperties(); @Override boolean isGranted(long permissions); @Override boolean isGranted(long permissions, @NotNull PropertyState property);  }
@Test public void testCanRead() { TreePermission tp = getTreePermission(accessSession, REPO_POLICY_PATH); assertTrue(tp.canRead()); }
@Test public void testCanRead2() { TreePermission tp = getTreePermission(noAccessSession, REPO_POLICY_PATH); assertFalse(tp.canRead()); }
@Test public void testCanReadAceNode() { TreePermission tp = getTreePermission(accessSession, root.getTree(REPO_POLICY_PATH).getChildren().iterator().next().getPath()); assertTrue(tp.canRead()); }
@Test public void testCanReadAceNode2() { TreePermission tp = getTreePermission(noAccessSession, root.getTree(REPO_POLICY_PATH).getChildren().iterator().next().getPath()); assertFalse(tp.canRead()); }
@Test public void testCanReadProperty() { TreePermission tp = getTreePermission(accessSession, REPO_POLICY_PATH); assertTrue(tp.canRead(PropertyStates.createProperty(JcrConstants.JCR_PRIMARYTYPE, NT_REP_ACL))); }
@Test public void testCanReadProperty2() { TreePermission tp = getTreePermission(noAccessSession, REPO_POLICY_PATH); assertFalse(tp.canRead(PropertyStates.createProperty(JcrConstants.JCR_PRIMARYTYPE, NT_REP_ACL))); }
@Test public void testCanReadPropertyAceNode() { Tree aceTree = root.getTree(REPO_POLICY_PATH).getChildren().iterator().next(); PropertyState principalProp = aceTree.getProperty(REP_PRINCIPAL_NAME); TreePermission tp = getTreePermission(accessSession, aceTree.getPath()); assertTrue(tp.canRead(principalProp)); }
@Test public void testCanReadPropertyAceNode2() { Tree aceTree = root.getTree(REPO_POLICY_PATH).getChildren().iterator().next(); PropertyState principalProp = aceTree.getProperty(REP_PRINCIPAL_NAME); TreePermission tp = getTreePermission(noAccessSession, aceTree.getPath()); assertFalse(tp.canRead(principalProp)); }