diff --git a/source/java/org/alfresco/repo/site/SiteServiceImpl.java b/source/java/org/alfresco/repo/site/SiteServiceImpl.java index 8deda3c049..6e889ee884 100644 --- a/source/java/org/alfresco/repo/site/SiteServiceImpl.java +++ b/source/java/org/alfresco/repo/site/SiteServiceImpl.java @@ -1447,7 +1447,8 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic // Build an array of name filter tokens pre lowercased to test against person properties // We require that matching people have at least one match against one of these on // either their firstname or last name - // For groups, we require a match against the whole filter on the group name + // For groups, we require a match against the whole filter on the group name or display name + String nameFilterLower = null; String[] nameFilters = new String[0]; if (nameFilter != null && nameFilter.length() != 0) { @@ -1457,6 +1458,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic { nameFilters[i] = t.nextToken().toLowerCase(); } + nameFilterLower = nameFilter.toLowerCase(); } Map members = new HashMap(32); @@ -1503,10 +1505,19 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic if (nameFilter != null && nameFilter.length() != 0) { // found a filter - does it match Group name part? - if (authority.substring(GROUP_PREFIX_LENGTH).toLowerCase().contains(nameFilter.toLowerCase())) + if (authority.substring(GROUP_PREFIX_LENGTH).toLowerCase().contains(nameFilterLower)) { members.put(authority, permission); } + else + { + // Does it match on the Group Display Name part instead? + String displayName = authorityService.getAuthorityDisplayName(authority); + if(displayName != null && displayName.toLowerCase().contains(nameFilterLower)) + { + members.put(authority, permission); + } + } } else { diff --git a/source/java/org/alfresco/repo/site/SiteServiceImplTest.java b/source/java/org/alfresco/repo/site/SiteServiceImplTest.java index 056cd6ac7d..4e665f376c 100644 --- a/source/java/org/alfresco/repo/site/SiteServiceImplTest.java +++ b/source/java/org/alfresco/repo/site/SiteServiceImplTest.java @@ -87,6 +87,8 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest private static final String GROUP_TWO = "GrpTwo_SiteServiceImplTest"; private static final String GROUP_THREE = "GrpThree_SiteServiceImplTest"; private static final String GROUP_FOUR = "GrpFour_SiteServiceImplTest"; + private static final String GROUP_ONE_DISPLAY = "DisplayOfGrpOne-SiteServiceImplTest"; + private static final String GROUP_TWO_DISPLAY = "DisplayOfGrpTwo-SiteServiceImplTest"; private CopyService copyService; private ScriptService scriptService; @@ -146,10 +148,10 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest createUser(USER_FOUR, "UsRFoUr"); // Create the test groups - this.groupOne = this.authorityService.createAuthority(AuthorityType.GROUP, GROUP_ONE); + this.groupOne = this.authorityService.createAuthority(AuthorityType.GROUP, GROUP_ONE, GROUP_ONE_DISPLAY, null); this.authorityService.addAuthority(this.groupOne, USER_TWO); - this.groupTwo = this.authorityService.createAuthority(AuthorityType.GROUP, GROUP_TWO); + this.groupTwo = this.authorityService.createAuthority(AuthorityType.GROUP, GROUP_TWO, GROUP_TWO_DISPLAY, null); this.authorityService.addAuthority(this.groupTwo, USER_TWO); this.authorityService.addAuthority(this.groupTwo, USER_THREE); @@ -1323,6 +1325,13 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest assertEquals(1, members.size()); assertTrue(members.containsKey(this.groupTwo)); assertEquals(SiteModel.SITE_CONSUMER, members.get(this.groupTwo)); + + // - filter by name - group display name + members = this.siteService.listMembers("testMembership", GROUP_TWO_DISPLAY, null, 0, false); + assertNotNull(members); + assertEquals(1, members.size()); + assertTrue(members.containsKey(this.groupTwo)); + assertEquals(SiteModel.SITE_CONSUMER, members.get(this.groupTwo)); // - filter by name - group name with expansion // (won't match anyone as the group name won't hit people too)