@Test public void testGetRulesForUserOnly() { RuleFilter filter; filter = new RuleFilter(RuleFilter.SpecialFilterType.ANY); assertEquals(0, ruleAdminService.count(filter)); UserGroup g1 = createRole("g1"); UserGroup g2 = createRole("g2"); String u1 = "TestUser1"; String u2 = "TestUser2"; String u3 = "TestUser3"; GSUser user1 = new GSUser(); user1.setName(u1); user1.getGroups().add(g1); GSUser user2 = new GSUser(); user2.setName(u2); user2.getGroups().add(g2); UserGroup g3a = createRole("g3a"); UserGroup g3b = createRole("g3b"); GSUser user3 = new GSUser(); user3.setName(u3); user3.getGroups().add(g3a); user3.getGroups().add(g3b); userAdminService.insert(user1); userAdminService.insert(user2); userAdminService.insert(user3); ruleAdminService.insert(new Rule(10, u1, "g1", null, null, "s1", "r1", "w1", "l1", GrantType.ALLOW)); ruleAdminService.insert(new Rule(20, u2, "g2", null, null, "s1", "r2", "w2", "l2", GrantType.ALLOW)); ruleAdminService.insert(new Rule(30, u1, "g1", null, null, "s3", "r3", "w3", "l3", GrantType.ALLOW)); ruleAdminService.insert(new Rule(40, u1, "g1", null, null, null, null, null, null, GrantType.ALLOW)); ruleAdminService.insert(new Rule(50, null, "g3a", null,null, null, null, null, null, GrantType.ALLOW)); ruleAdminService.insert(new Rule(60, null, "g3b", null,null, null, null, null, null, GrantType.ALLOW)); filter = createFilter(u1, null, null); assertEquals(3, ruleReaderService.getMatchingRules(filter).size()); filter = createFilter(u1, null, "s1"); assertEquals(2, ruleReaderService.getMatchingRules(filter).size()); filter = createFilter(u1, null, "s3"); assertEquals(2, ruleReaderService.getMatchingRules(filter).size()); filter = createFilter("anonymous", null, null); assertEquals(0, ruleReaderService.getMatchingRules(filter).size()); }
@Override @Deprecated public List<ShortRule> getMatchingRules( String userName, String profileName, String instanceName, String sourceAddress, String service, String request, String workspace, String layer) { return getMatchingRules(new RuleFilter(userName, profileName, instanceName, sourceAddress, service, request, workspace, layer)); }
RuleReaderServiceImpl implements RuleReaderService { @Override @Deprecated public List<ShortRule> getMatchingRules( String userName, String profileName, String instanceName, String sourceAddress, String service, String request, String workspace, String layer) { return getMatchingRules(new RuleFilter(userName, profileName, instanceName, sourceAddress, service, request, workspace, layer)); } }
RuleReaderServiceImpl implements RuleReaderService { @Override @Deprecated public List<ShortRule> getMatchingRules( String userName, String profileName, String instanceName, String sourceAddress, String service, String request, String workspace, String layer) { return getMatchingRules(new RuleFilter(userName, profileName, instanceName, sourceAddress, service, request, workspace, layer)); }  }
RuleReaderServiceImpl implements RuleReaderService { @Override @Deprecated public List<ShortRule> getMatchingRules( String userName, String profileName, String instanceName, String sourceAddress, String service, String request, String workspace, String layer) { return getMatchingRules(new RuleFilter(userName, profileName, instanceName, sourceAddress, service, request, workspace, layer)); }  @Override @Deprecated List<ShortRule> getMatchingRules(
                    String userName, String profileName, String instanceName,
                    String sourceAddress,
                    String service, String request,
                    String workspace, String layer); @Override List<ShortRule> getMatchingRules(RuleFilter filter); @Override @Deprecated AccessInfo getAccessInfo(String userName, String roleName, String instanceName,
            String sourceAddress,
            String service, String request,
            String workspace, String layer); @Override AccessInfo getAccessInfo(RuleFilter filter); @Override AccessInfo getAdminAuthorization(RuleFilter filter); @Override @Deprecated AuthUser authorize(String username, String password); void setRuleDAO(RuleDAO ruleDAO); void setAdminRuleDAO(AdminRuleDAO adminRuleDAO); void setLayerDetailsDAO(LayerDetailsDAO detailsDAO); void setUserResolver(UserResolver userResolver); void setAuthorizationService(AuthorizationService authorizationService); }
RuleReaderServiceImpl implements RuleReaderService { @Override @Deprecated public List<ShortRule> getMatchingRules( String userName, String profileName, String instanceName, String sourceAddress, String service, String request, String workspace, String layer) { return getMatchingRules(new RuleFilter(userName, profileName, instanceName, sourceAddress, service, request, workspace, layer)); }  @Override @Deprecated List<ShortRule> getMatchingRules(
                    String userName, String profileName, String instanceName,
                    String sourceAddress,
                    String service, String request,
                    String workspace, String layer); @Override List<ShortRule> getMatchingRules(RuleFilter filter); @Override @Deprecated AccessInfo getAccessInfo(String userName, String roleName, String instanceName,
            String sourceAddress,
            String service, String request,
            String workspace, String layer); @Override AccessInfo getAccessInfo(RuleFilter filter); @Override AccessInfo getAdminAuthorization(RuleFilter filter); @Override @Deprecated AuthUser authorize(String username, String password); void setRuleDAO(RuleDAO ruleDAO); void setAdminRuleDAO(AdminRuleDAO adminRuleDAO); void setLayerDetailsDAO(LayerDetailsDAO detailsDAO); void setUserResolver(UserResolver userResolver); void setAuthorizationService(AuthorizationService authorizationService);  }