CugTreePermission extends AbstractTreePermission implements CugConstants { boolean isInCug() { if (status == null) { loadStatus(); } return status.inCug; } CugTreePermission(@NotNull Tree tree, @NotNull TreeType type, @NotNull TreePermission parent,
                      @NotNull CugPermissionProvider permissionProvider);   CugTreePermission(@NotNull Tree tree, @NotNull TreeType type, @NotNull TreePermission parent,
                      @NotNull CugPermissionProvider permissionProvider, boolean inCug, boolean canRead, boolean hasNestedCug); @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 testIsInCug() { assertTrue(allowedTp.isInCug()); assertTrue(deniedTp.isInCug()); }
@Test public void testIsInCugChild() throws Exception { String childPath = SUPPORTED_PATH + "/subtree"; CugTreePermission tp = getCugTreePermission(childPath); assertTrue(tp.isInCug()); tp = getCugTreePermission(childPath, getTestUser().getPrincipal(), EveryonePrincipal.getInstance()); assertTrue(tp.isInCug()); }
@Test public void testIsInCugNestedCug() throws Exception { String childPath = SUPPORTED_PATH + "/subtree"; createCug(childPath, EveryonePrincipal.getInstance()); root.commit(); CugTreePermission tp = getCugTreePermission(childPath); assertTrue(tp.isInCug()); tp = getCugTreePermission(childPath, getTestUser().getPrincipal(), EveryonePrincipal.getInstance()); assertTrue(tp.isInCug()); }
@Test public void testIsInCugSupportedPathWithoutCug() throws Exception { Tree node = root.getTree(SUPPORTED_PATH2); Tree c1 = TreeUtil.addChild(node, "c1", NT_OAK_UNSTRUCTURED); Tree c2 = TreeUtil.addChild(node, "c2", NT_OAK_UNSTRUCTURED); String cugPath = c2.getPath(); createCug(cugPath, getTestGroupPrincipal()); root.commit(); assertTrue(getCugTreePermission(cugPath).isInCug()); assertFalse(getCugTreePermission(c1.getPath()).isInCug()); }