CompositeAccessControlManager extends AbstractAccessControlManager { @Override public void removePolicy(String absPath, AccessControlPolicy policy) throws RepositoryException { for (AccessControlManager acMgr : acMgrs) { if (acMgr instanceof PolicyOwner && ((PolicyOwner) acMgr).defines(absPath, policy)) { acMgr.removePolicy(absPath, policy); return; } } throw new AccessControlException("Cannot remove access control policy " + policy + "; no PolicyOwner found."); } CompositeAccessControlManager(@NotNull Root root,
                                         @NotNull NamePathMapper namePathMapper,
                                         @NotNull SecurityProvider securityProvider,
                                         @NotNull List<AccessControlManager> acMgrs,
                                         @NotNull AggregationFilter aggregationFilter); @NotNull @Override Privilege[] getSupportedPrivileges(String absPath); @Override AccessControlPolicy[] getPolicies(String absPath); @Override AccessControlPolicy[] getEffectivePolicies(String absPath); @Override AccessControlPolicyIterator getApplicablePolicies(String absPath); @Override void setPolicy(String absPath, AccessControlPolicy policy); @Override void removePolicy(String absPath, AccessControlPolicy policy); @NotNull @Override JackrabbitAccessControlPolicy[] getApplicablePolicies(@NotNull Principal principal); @NotNull @Override JackrabbitAccessControlPolicy[] getPolicies(@NotNull Principal principal); @NotNull @Override AccessControlPolicy[] getEffectivePolicies(@NotNull Set<Principal> principals);  }
@Test public void testRemovePolicy() throws Exception { AccessControlPolicyIterator it = acMgr.getApplicablePolicies(TEST_PATH); while (it.hasNext()) { AccessControlPolicy plc = it.nextAccessControlPolicy(); acMgr.setPolicy(TEST_PATH, plc); } root.commit(); acMgr.removePolicy(TEST_PATH, TestPolicy.INSTANCE); root.commit(); assertEquals(1, acMgr.getPolicies(TEST_PATH).length); acMgr.removePolicy(TEST_PATH, acMgr.getPolicies(TEST_PATH)[0]); root.commit(); assertEquals(0, acMgr.getPolicies(TEST_PATH).length); }