ALF-10001 Update SiteService.listMembers to check group display names as well as group names, plus test

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30225 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-09-05 14:22:01 +00:00
parent 32b756a7f9
commit f694b1c928
2 changed files with 24 additions and 4 deletions

View File

@@ -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<String, String> members = new HashMap<String, String>(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
{