@Test public void testGetRulesForUsersAndGroup() { RuleFilter filter; filter = new RuleFilter(RuleFilter.SpecialFilterType.ANY); assertEquals(0, ruleAdminService.count(filter)); UserGroup p1 = createRole("p1"); UserGroup p2 = createRole("p2"); String u1 = "TestUser1"; String u2 = "TestUser2"; String u3 = "TestUser3"; GSUser user1 = new GSUser(); user1.setName(u1); user1.getGroups().add(p1); GSUser user2 = new GSUser(); user2.setName(u2); user2.getGroups().add(p2); 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, "p1", null, null, "s1", "r1", "w1", "l1", GrantType.ALLOW)); ruleAdminService.insert(new Rule(20, u2, "p2", null, null, "s1", "r2", "w2", "l2", GrantType.ALLOW)); ruleAdminService.insert(new Rule(30, u1, "p1", null, null, "s3", "r3", "w3", "l3", GrantType.ALLOW)); ruleAdminService.insert(new Rule(40, u1, "p1", 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)); assertEquals(3, ruleReaderService.getMatchingRules(u1, "*", "Z","*", "*", "*","*","*").size()); assertEquals(3, ruleReaderService.getMatchingRules("*", "p1", "Z","*", "*", "*","*","*").size()); assertEquals(1, ruleReaderService.getMatchingRules(u1, "*", "Z","*", null, null,null,null).size()); assertEquals(0, ruleReaderService.getMatchingRules("*", "Z", "Z","*", null, null,null,null).size()); assertEquals(1, ruleReaderService.getMatchingRules(u1, "*", "Z","*", null, null,null,null).size()); assertEquals(1, ruleReaderService.getMatchingRules(u1, "*", "Z","*", null, null,null,null).size()); assertEquals(1, ruleReaderService.getMatchingRules(u2, "*", "Z","*", "*", "*","*","*").size()); assertEquals(1, ruleReaderService.getMatchingRules("*", "p2", "Z","*", "*", "*","*","*").size()); assertEquals(2, ruleReaderService.getMatchingRules(u1, "*", "Z","*", "s1", "*","*","*").size()); assertEquals(2, ruleReaderService.getMatchingRules("*", "p1", "Z","*", "s1", "*","*","*").size()); assertEquals(2, ruleReaderService.getMatchingRules(u3, "*", "Z","*", "s1", "*","*","*").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);  }