PrincipalRestrictionProvider implements RestrictionProvider, AccessControlConstants { @Override public void writeRestrictions(String oakPath, Tree aceTree, Set<Restriction> restrictions) throws RepositoryException { Set<Restriction> rs = Sets.newHashSet(restrictions); rs.removeIf(r -> REP_NODE_PATH.equals(r.getDefinition().getName())); base.writeRestrictions(oakPath, aceTree, rs); } PrincipalRestrictionProvider(RestrictionProvider base); @NotNull @Override Set<RestrictionDefinition> getSupportedRestrictions(@Nullable String oakPath); @NotNull @Override Restriction createRestriction(@Nullable String oakPath, @NotNull String oakName, @NotNull Value value); @NotNull @Override Restriction createRestriction(@Nullable String oakPath, @NotNull String oakName, @NotNull Value... values); @NotNull @Override Set<Restriction> readRestrictions(@Nullable String oakPath, @NotNull Tree aceTree); @Override void writeRestrictions(String oakPath, Tree aceTree, Set<Restriction> restrictions); @Override void validateRestrictions(String oakPath, @NotNull Tree aceTree); @NotNull @Override RestrictionPattern getPattern(@Nullable String oakPath, @NotNull Tree tree); @NotNull @Override RestrictionPattern getPattern(@Nullable String oakPath, @NotNull Set<Restriction> restrictions);  }
@Test public void testWriteRestrictions() throws Exception { Tree t = mock(Tree.class); Value v = getValueFactory(root).createValue("/path"); PropertyState ps = PropertyStates.createProperty(REP_NODE_PATH, v); Set<Restriction> rs = ImmutableSet.of(new RestrictionImpl(ps, true)); provider.writeRestrictions("/testPath", t, rs); verify(base, never()).writeRestrictions("/testPath", t, Sets.newHashSet(rs)); verify(base, times(1)).writeRestrictions("/testPath", t, Sets.newHashSet()); }