RepoPolicyTreePermission implements TreePermission { @Override public boolean isGranted(long permissions) { return repoPermission.isGranted(permissions); } 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 testIsGranted() { TreePermission tp = getTreePermission(accessSession, REPO_POLICY_PATH); assertTrue(tp.isGranted(Permissions.NAMESPACE_MANAGEMENT)); assertFalse(tp.isGranted(Permissions.WORKSPACE_MANAGEMENT)); assertFalse(tp.isGranted(Permissions.NAMESPACE_MANAGEMENT|Permissions.WORKSPACE_MANAGEMENT)); }
@Test public void testIsGranted2() { TreePermission tp = getTreePermission(noAccessSession, REPO_POLICY_PATH); assertFalse(tp.isGranted(Permissions.NAMESPACE_MANAGEMENT)); assertFalse(tp.isGranted(Permissions.WORKSPACE_MANAGEMENT)); assertFalse(tp.isGranted(Permissions.NAMESPACE_MANAGEMENT|Permissions.WORKSPACE_MANAGEMENT)); }
@Test public void testIsGrantedProperty() { PropertyState ps = PropertyStates.createProperty("name", "value"); TreePermission tp = getTreePermission(accessSession, REPO_POLICY_PATH); assertTrue(tp.isGranted(Permissions.NAMESPACE_MANAGEMENT, ps)); assertFalse(tp.isGranted(Permissions.WORKSPACE_MANAGEMENT, ps)); assertFalse(tp.isGranted(Permissions.NAMESPACE_MANAGEMENT|Permissions.WORKSPACE_MANAGEMENT, ps)); }
@Test public void testIsGrantedProperty2() { PropertyState ps = PropertyStates.createProperty("name", "value"); TreePermission tp = getTreePermission(noAccessSession, REPO_POLICY_PATH); assertFalse(tp.isGranted(Permissions.NAMESPACE_MANAGEMENT, ps)); assertFalse(tp.isGranted(Permissions.WORKSPACE_MANAGEMENT, ps)); assertFalse(tp.isGranted(Permissions.NAMESPACE_MANAGEMENT|Permissions.WORKSPACE_MANAGEMENT, ps)); }