PermissionProviderImpl implements PermissionProvider, AccessControlConstants, PermissionConstants, AggregatedPermissionProvider { @NotNull @Override public TreePermission getTreePermission(@NotNull Tree tree, @NotNull TreePermission parentPermission) { return getCompiledPermissions().getTreePermission(PermissionUtil.getReadOnlyTree(tree, immutableRoot), parentPermission); } PermissionProviderImpl(@NotNull Root root,
                                  @NotNull String workspaceName,
                                  @NotNull Set<Principal> principals,
                                  @NotNull RestrictionProvider restrictionProvider,
                                  @NotNull ConfigurationParameters options,
                                  @NotNull Context ctx,
                                  @NotNull ProviderCtx providerCtx); @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, @Nullable 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 @Override TreePermission getTreePermission(@NotNull Tree tree, @NotNull TreeType type, @NotNull TreePermission parentPermission);  }
@Test public void testTreePermissionsForReadPaths() { Root r = testSession.getLatestRoot(); Tree tree = r.getTree(PathUtils.ROOT_PATH); assertFalse(tree.exists()); assertFalse(pp.getTreePermission(tree, TreePermission.EMPTY).canRead()); for (String path : READ_PATHS) { tree = r.getTree(path); assertTrue(tree.exists()); assertTrue(pp.getTreePermission(tree, TreePermission.EMPTY).canRead()); } }