AggregationFilterImpl implements AggregationFilter { @Override public boolean stop(@NotNull AggregatedPermissionProvider permissionProvider, @NotNull Set<Principal> principals) { return permissionProvider instanceof PrincipalBasedPermissionProvider; }  @Override boolean stop(@NotNull AggregatedPermissionProvider permissionProvider, @NotNull Set<Principal> principals); @Override boolean stop(@NotNull JackrabbitAccessControlManager accessControlManager, @NotNull Set<Principal> principals); @Override boolean stop(@NotNull AccessControlManager accessControlManager, @Nullable String absPath);  }
@Test public void testStopPermissionProviderTrue() { assertTrue(aggregationFilter.stop(createPermissionProvider(root, systemUserPrincipals.toArray(new Principal[0])), systemUserPrincipals)); }
@Test public void testStopPermissionProviderFalse() { assertFalse(aggregationFilter.stop(mock(AggregatedPermissionProvider.class), systemUserPrincipals)); assertFalse(aggregationFilter.stop(mock(AggregatedPermissionProvider.class), testUserPrincipals)); PermissionProvider pp = getConfig(AuthorizationConfiguration.class).getPermissionProvider(root, adminSession.getWorkspaceName(), systemUserPrincipals); if (pp instanceof AggregatedPermissionProvider) { assertFalse(aggregationFilter.stop((AggregatedPermissionProvider) pp, systemUserPrincipals)); } pp = getConfig(AuthorizationConfiguration.class).getPermissionProvider(root, adminSession.getWorkspaceName(), testUserPrincipals); if (pp instanceof AggregatedPermissionProvider) { assertFalse(aggregationFilter.stop((AggregatedPermissionProvider) pp, testUserPrincipals)); } }
@Test public void testStopAcMgrPrincipalsTrue() { assertTrue(aggregationFilter.stop(createAccessControlManager(root), systemUserPrincipals)); }
@Test public void testStopAcMgrPrincipalsFalse() { assertFalse(aggregationFilter.stop(mock(JackrabbitAccessControlManager.class), systemUserPrincipals)); assertFalse(aggregationFilter.stop(mock(JackrabbitAccessControlManager.class), testUserPrincipals)); assertFalse(aggregationFilter.stop(createAccessControlManager(root), testUserPrincipals)); AccessControlManager acMgr = getConfig(AuthorizationConfiguration.class).getAccessControlManager(root, getNamePathMapper()); if (acMgr instanceof JackrabbitAccessControlManager) { assertFalse(aggregationFilter.stop((JackrabbitAccessControlManager) acMgr, systemUserPrincipals)); } }
@Test public void testStopAcMgrPrincipalsInvalid() { assertFalse(aggregationFilter.stop(createAccessControlManager(root), ImmutableSet.of(new PrincipalImpl("invalid")))); }
@Test public void testStopAcMgrPath() { assertFalse(aggregationFilter.stop(createAccessControlManager(root), PathUtils.ROOT_PATH)); assertFalse(aggregationFilter.stop(createAccessControlManager(root), SUPPORTED_PATH)); assertFalse(aggregationFilter.stop(getConfig(AuthorizationConfiguration.class).getAccessControlManager(root, getNamePathMapper()), SUPPORTED_PATH)); }