diff --git a/source/java/org/alfresco/repo/site/SiteServiceImpl.java b/source/java/org/alfresco/repo/site/SiteServiceImpl.java index e7b6f7d262..16b622b4d7 100644 --- a/source/java/org/alfresco/repo/site/SiteServiceImpl.java +++ b/source/java/org/alfresco/repo/site/SiteServiceImpl.java @@ -1210,26 +1210,22 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic { final int maxResults = size > 0 ? size : 1000; final Set siteNames = new TreeSet(); - - // MNT-13198 - use the bridge table - String actualUserName = personService.getUserIdentifier(userName); - if(actualUserName != null) - { - Set containingAuthorities = authorityService.getContainingAuthorities(AuthorityType.GROUP, actualUserName, false); - for(String authority : containingAuthorities) + authorityService.getContainingAuthoritiesInZone(AuthorityType.GROUP, userName, AuthorityService.ZONE_APP_SHARE, new AuthorityFilter(){ + @Override + public boolean includeAuthority(String authority) { if (siteNames.size() < maxResults) { String siteName = resolveSite(authority); // MNT-10836 fix, after MNT-10109 we should also check site existence - // A simple exists check would be better than getting the site properties etc - profiling suggests x2 faster - if ((siteName != null) && hasSite(siteName)) + if (siteName == null || getSite(siteName) == null) { - siteNames.add(siteName); + return false; } + return siteNames.add(siteName); } - } - } + return false; + }}, maxResults); if (siteNames.isEmpty()) { return Collections.emptyList();