ALF-1999: Refactored AuthorityService.findAuthorities to support search options required by Alfresco Explorer client in efficient manner

- optional parentAuthority argument - when set will only search for authorities under a given group
- optional immediate flag - when false means do a recursive search. When true means only return first level. When true and parentAuthority is null means root groups.
- search expression - which is tested against the short name and the display name
- reworked all existing calls for new semantics
- this method is for UI search only - not for existence checking!
  - removed some ill-informed calls


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19203 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2010-03-10 18:46:02 +00:00
parent 893cc14f16
commit 477e9d61a1
3 changed files with 8 additions and 8 deletions

View File

@@ -22,7 +22,6 @@ import java.util.Set;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.cmr.security.AuthorityType;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.web.bean.spaces.InviteSpaceUsersWizard;
/**
@@ -35,9 +34,10 @@ public class MailInviteSpaceUsersWizard extends InviteSpaceUsersWizard
protected Set<String> getGroups(String search)
{
// groups - text search match on supplied name
String term = PermissionService.GROUP_PREFIX + "*" + search + "*";
String term = "*" + search + "*";
Set<String> groups;
groups = getAuthorityService().findAuthoritiesInZone(AuthorityType.GROUP, term, AuthorityService.ZONE_APP_DEFAULT);
groups = getAuthorityService().findAuthorities(AuthorityType.GROUP, null, false, term,
AuthorityService.ZONE_APP_DEFAULT);
return groups;
}
}

View File

@@ -286,9 +286,9 @@ public class SetPermissionsDialog extends UpdatePermissionsDialog
else
{
// groups - text search match on supplied name
String term = PermissionService.GROUP_PREFIX + "*" + contains.trim() + "*";
String term = "*" + contains.trim() + "*";
Set<String> groups;
groups = getAuthorityService().findAuthoritiesInZone(AuthorityType.GROUP, term, AuthorityService.ZONE_APP_DEFAULT);
groups = getAuthorityService().findAuthorities(AuthorityType.GROUP, null, false, term, AuthorityService.ZONE_APP_DEFAULT);
groups.addAll(getAuthorityService().getAllAuthorities(AuthorityType.EVERYONE));
String groupDisplayName;

View File

@@ -63,7 +63,6 @@ import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIGenericPicker;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.BooleanQuery;
import org.springframework.mail.javamail.JavaMailSender;
@@ -563,9 +562,10 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean
protected Set<String> getGroups(String search)
{
// groups - text search match on supplied name
String term = PermissionService.GROUP_PREFIX + "*" + search + "*";
String term = "*" + search + "*";
Set<String> groups;
groups = getAuthorityService().findAuthoritiesInZone(AuthorityType.GROUP, term, AuthorityService.ZONE_APP_DEFAULT);
groups = getAuthorityService().findAuthorities(AuthorityType.GROUP, null, false, term,
AuthorityService.ZONE_APP_DEFAULT);
groups.addAll(getAuthorityService().getAllAuthorities(AuthorityType.EVERYONE));
return groups;
}