@NotNull @Override public Set<RestrictionDefinition> getSupportedRestrictions(@Nullable String oakPath) { Set<RestrictionDefinition> defs = Sets.newHashSet(); for (RestrictionProvider rp : providers) { defs.addAll(rp.getSupportedRestrictions(oakPath)); } return defs; }
@NotNull @Override public Restriction createRestriction(@Nullable String oakPath, @NotNull String oakName, @NotNull Value... values) throws RepositoryException { return base.createRestriction(oakPath, oakName, values); }
@Nonnull @Override public RestrictionPattern getPattern(@Nullable String oakPath, @Nonnull Tree tree) { return base.getPattern(oakPath, tree); }
@Nonnull @Override public Set<Restriction> readRestrictions(@Nullable String oakPath, @Nonnull Tree aceTree) { Set<Restriction> restrictions = Sets.newHashSet(); for (RestrictionProvider rp : providers) { restrictions.addAll(rp.readRestrictions(oakPath, aceTree)); } return restrictions; }
@Override public void writeRestrictions(String oakPath, Tree aceTree, Set<Restriction> restrictions) throws RepositoryException { getProvider().writeRestrictions(oakPath, aceTree, restrictions); }
private RestrictionPattern buildGlobPattern(@NotNull String path, @NotNull String glob) throws Exception { RestrictionProvider rp = getConfig(AuthorizationConfiguration.class).getRestrictionProvider(); Restriction restriction = rp.createRestriction(path, AccessControlConstants.REP_GLOB, getValueFactory(root).createValue(glob)); return rp.getPattern(path, ImmutableSet.of(restriction)); }
@Override public void validateRestrictions(String oakPath, @NotNull Tree aceTree) throws RepositoryException { base.validateRestrictions(oakPath, aceTree); }
@Test public void testWriteRestrictions() throws Exception { NodeUtil aceNode = new NodeUtil(root.getTree("/")).addChild("test", NT_REP_GRANT_ACE); Set<Restriction> restrictions = ImmutableSet.of( provider.createRestriction("/test","boolean", vf.createValue(true)), provider.createRestriction("/test", "longs"), provider.createRestriction("/test", REP_GLOB, vf.createValue("*")), provider.createRestriction("/test", REP_NT_NAMES, vf.createValue("nt:base", PropertyType.NAME), vf.createValue("nt:version", PropertyType.NAME))); provider.writeRestrictions("/test", aceNode.getTree(), restrictions); }
@NotNull @Override public Set<Restriction> readRestrictions(@Nullable String oakPath, @NotNull Tree aceTree) { Set<Restriction> restrictions = Sets.newHashSet(); for (RestrictionProvider rp : providers) { restrictions.addAll(rp.readRestrictions(oakPath, aceTree)); } return restrictions; }
@Override public void writeRestrictions(String oakPath, Tree aceTree, Set<Restriction> restrictions) throws RepositoryException { getProvider().writeRestrictions(oakPath, aceTree, restrictions); }
@Override public void validateRestrictions(String oakPath, @Nonnull Tree aceTree) throws RepositoryException { base.validateRestrictions(oakPath, aceTree); }
@Nonnull @Override public Set<RestrictionDefinition> getSupportedRestrictions(@Nullable String oakPath) { Set<RestrictionDefinition> defs = Sets.newHashSet(); for (RestrictionProvider rp : providers) { defs.addAll(rp.getSupportedRestrictions(oakPath)); } return defs; }
@Nonnull @Override public RestrictionPattern getPattern(@Nullable String oakPath, @Nonnull Set<Restriction> restrictions) { return base.getPattern(oakPath, restrictions); } }
@Nonnull @Override public Restriction createRestriction(@Nullable String oakPath, @Nonnull String oakName, @Nonnull Value... values) throws RepositoryException { return base.createRestriction(oakPath, oakName, values); }
@NotNull @Override public Set<Restriction> readRestrictions(@Nullable String oakPath, @NotNull Tree aceTree) { return getProvider().readRestrictions(oakPath, aceTree); }
@Override public void writeRestrictions(String oakPath, Tree aceTree, Set<Restriction> restrictions) throws RepositoryException { getProvider().writeRestrictions(oakPath, aceTree, restrictions); }
@Override public void validateRestrictions(String oakPath, @NotNull Tree aceTree) throws RepositoryException { base.validateRestrictions(oakPath, aceTree); }
@NotNull @Override public Set<RestrictionDefinition> getSupportedRestrictions(@Nullable String oakPath) { return getProvider().getSupportedRestrictions(oakPath); }
@NotNull @Override public RestrictionPattern getPattern(@Nullable String oakPath, @NotNull Tree tree) { return base.getPattern(oakPath, tree); }
@NotNull @Override public Restriction createRestriction(@Nullable String oakPath, @NotNull String oakName, @NotNull Value... values) throws RepositoryException { return base.createRestriction(oakPath, oakName, values); }