CugPermissionProvider implements AggregatedPermissionProvider, CugConstants { boolean isAllow(@NotNull Tree cugTree) { PropertyState princNamesState = cugTree.getProperty(REP_PRINCIPAL_NAMES); if (princNamesState != null) { for (String pName : princNamesState.getValue(Type.STRINGS)) { for (String pN : principalNames) { if (pName.equals(pN)) { return true; } } } } return false; } CugPermissionProvider(@NotNull Root root,
                          @NotNull String workspaceName,
                          @NotNull Set<Principal> principals,
                          @NotNull Set<String> supportedPaths,
                          @NotNull Context ctx,
                          @NotNull RootProvider rootProvider,
                          @NotNull TreeProvider treeProvider); @Override void refresh(); @NotNull @Override Set<String> getPrivileges(@Nullable Tree tree); @Override boolean hasPrivileges(@Nullable Tree tree, @NotNull String... privilegeNames); @NotNull @Override RepositoryPermission getRepositoryPermission(); @NotNull @Override TreePermission getTreePermission(@NotNull Tree tree, @NotNull TreePermission parentPermission); @Override boolean isGranted(@NotNull Tree tree, PropertyState property, long permissions); @Override boolean isGranted(@NotNull String oakPath, @NotNull String jcrActions); @NotNull @Override PrivilegeBits supportedPrivileges(@Nullable Tree tree, @Nullable PrivilegeBits privilegeBits); @Override long supportedPermissions(@Nullable Tree tree, @Nullable PropertyState property, long permissions); @Override long supportedPermissions(@NotNull TreeLocation location, long permissions); @Override long supportedPermissions(@NotNull TreePermission treePermission, @Nullable PropertyState property, long permissions); @Override boolean isGranted(@NotNull TreeLocation location, long permissions); @NotNull TreePermission getTreePermission(@NotNull Tree immutableTree, @NotNull TreeType type, @NotNull TreePermission parentPermission);  }
@Test public void testIsAllowMissingPrincipalNames() { Tree cugTree = root.getTree("/content/a").getChild(REP_CUG_POLICY); cugTree.removeProperty(REP_PRINCIPAL_NAMES); assertFalse(cugPermProvider.isAllow(cugTree)); }