PermissionProviderImpl implements PermissionProvider, AccessControlConstants, PermissionConstants, AggregatedPermissionProvider { @NotNull @Override public Set<String> getPrivileges(@Nullable Tree tree) { return getCompiledPermissions().getPrivileges(PermissionUtil.getReadOnlyTreeOrNull(tree, immutableRoot)); } 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 testGetPrivilegesForReadPaths() { for (String path : READ_PATHS) { Tree tree = root.getTree(path); assertEquals(Collections.singleton(PrivilegeConstants.JCR_READ), pp.getPrivileges(tree)); } assertEquals(Collections.<String>emptySet(), pp.getPrivileges(null)); }