RestrictionProviderImpl extends AbstractRestrictionProvider { @Override public void validateRestrictions(String oakPath, @NotNull Tree aceTree) throws AccessControlException { super.validateRestrictions(oakPath, aceTree); Tree restrictionsTree = getRestrictionsTree(aceTree); PropertyState glob = restrictionsTree.getProperty(REP_GLOB); if (glob != null) { GlobPattern.validate(glob.getValue(Type.STRING)); } } RestrictionProviderImpl(); @NotNull @Override RestrictionPattern getPattern(String oakPath, @NotNull Tree tree); @NotNull @Override RestrictionPattern getPattern(@Nullable String oakPath, @NotNull Set<Restriction> restrictions); @Override void validateRestrictions(String oakPath, @NotNull Tree aceTree);  }
@Test(expected = AccessControlException.class) public void testValidateGlobRestriction() throws Exception { Tree t = TreeUtil.getOrAddChild(root.getTree("/"), "testTree", JcrConstants.NT_UNSTRUCTURED); String path = t.getPath(); AccessControlManager acMgr = getAccessControlManager(root); List<String> globs = ImmutableList.of( "/1*/2*/3*/4*/5*/6*/7*/8*/9*/10*/11*/12*/13*/14*/15*/16*/17*/18*/19*/20*/21*", "*********************"); for (String glob : globs) { JackrabbitAccessControlList acl = AccessControlUtils.getAccessControlList(acMgr, path); acl.addEntry(getTestUser().getPrincipal(), AccessControlUtils.privilegesFromNames(acMgr, PrivilegeConstants.JCR_READ), true, Collections.singletonMap(REP_GLOB, getValueFactory().createValue(glob))); acMgr.setPolicy(path, acl); try { provider.validateRestrictions(path, t.getChild(REP_POLICY).getChild("allow")); } finally { acMgr.removePolicy(path, acl); } } }