Fixed issues found as a result of ALF-9636: SVC 67: Lucene removal: Sanity test Share UI with Lucene turned off

Fixed ALF-9686: It's impossible to find any group at the Manage Space Users page

Fixed ALF-9673: It's impossible to find any site

Fixed ALF-9669: Site invite fails using SOLR while building email - need to remove query use in invite.

NOTE: Searches from the UI are now consistent in that by default a canned query based search (consistent results) are performed by default for people, group, user & site searches, to force a lucene based search that support the "contains" type query users must prefix their search with *, this is no longer added by default by the UI.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29628 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2011-08-09 11:35:51 +00:00
parent df778d8246
commit 1b499b662a
4 changed files with 74 additions and 20 deletions

View File

@@ -32,6 +32,8 @@ import javax.faces.event.ActionEvent;
import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.query.PagingRequest;
import org.alfresco.query.PagingResults;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.cmr.security.AuthorityType;
@@ -448,8 +450,23 @@ public class GroupsDialog extends BaseDialogBean
}
else
{
List<String> authorities;
if (search != null && search.startsWith("*"))
{
// if the search term starts with a wildcard use Lucene based search to find groups (results will be inconsistent)
boolean immediate = (this.filterMode.equals(FILTER_CHILDREN));
Set<String> authorities = this.authService.findAuthorities(AuthorityType.GROUP, this.group, immediate, search, AuthorityService.ZONE_APP_DEFAULT);
Set<String> results = this.authService.findAuthorities(AuthorityType.GROUP, this.group, immediate, search, AuthorityService.ZONE_APP_DEFAULT);
authorities = new ArrayList<String>(results);
}
else
{
// all other searches use the canned query so search results are consistent
PagingResults<String> pagedResults = this.authService.getAuthorities(AuthorityType.GROUP,
AuthorityService.ZONE_APP_DEFAULT, search, true, true, new PagingRequest(10000));
authorities = pagedResults.getPage();
}
groups = new ArrayList<Map<String,String>>(authorities.size());
for (String authority : authorities)
{

View File

@@ -20,8 +20,6 @@ package org.alfresco.web.bean.users;
import java.util.Set;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.cmr.security.AuthorityType;
import org.alfresco.web.bean.spaces.InviteSpaceUsersWizard;
/**
@@ -30,14 +28,12 @@ import org.alfresco.web.bean.spaces.InviteSpaceUsersWizard;
*/
public class MailInviteSpaceUsersWizard extends InviteSpaceUsersWizard
{
private static final long serialVersionUID = -68947308160920434L;
@Override
protected Set<String> getGroups(String search)
{
// groups - text search match on supplied name
String term = "*" + search + "*";
Set<String> groups;
groups = getAuthorityService().findAuthorities(AuthorityType.GROUP, null, false, term,
AuthorityService.ZONE_APP_DEFAULT);
return groups;
// get the groups without the EVERYONE group
return super.getGroups(search, false);
}
}

View File

@@ -24,6 +24,7 @@ import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
@@ -39,6 +40,7 @@ import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.query.PagingRequest;
import org.alfresco.query.PagingResults;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -276,10 +278,24 @@ public class SetPermissionsDialog extends UpdatePermissionsDialog
}
else
{
// groups - text search match on supplied name
String term = "*" + contains.trim() + "*";
Set<String> groups;
groups = getAuthorityService().findAuthorities(AuthorityType.GROUP, null, false, term, AuthorityService.ZONE_APP_DEFAULT);
if (contains != null && contains.startsWith("*"))
{
// if the search term starts with a wildcard use Lucene based search to find groups (results will be inconsistent)
String term = contains.trim() + "*";
groups = getAuthorityService().findAuthorities(AuthorityType.GROUP, null, false, term,
AuthorityService.ZONE_APP_DEFAULT);
}
else
{
// all other searches use the canned query so search results are consistent
PagingResults<String> pagedResults = getAuthorityService().getAuthorities(AuthorityType.GROUP,
AuthorityService.ZONE_APP_DEFAULT, contains, true, true, new PagingRequest(10000));
groups = new LinkedHashSet<String>(pagedResults.getPage());
}
// add the EVERYONE group to the results
groups.addAll(getAuthorityService().getAllAuthorities(AuthorityType.EVERYONE));
String groupDisplayName;

View File

@@ -24,10 +24,12 @@ import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.TreeSet;
import javax.faces.component.UISelectOne;
import javax.faces.context.FacesContext;
@@ -39,6 +41,7 @@ import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.query.PagingRequest;
import org.alfresco.query.PagingResults;
import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -548,12 +551,34 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean
protected Set<String> getGroups(String search)
{
// groups - text search match on supplied name
String term = "*" + search + "*";
return getGroups(search, true);
}
protected Set<String> getGroups(String search, boolean includeEveryone)
{
Set<String> groups;
if (search != null && search.startsWith("*"))
{
// if the search term starts with a wildcard use Lucene based search to find groups (results will be inconsistent)
String term = search.trim() + "*";
groups = getAuthorityService().findAuthorities(AuthorityType.GROUP, null, false, term,
AuthorityService.ZONE_APP_DEFAULT);
}
else
{
// all other searches use the canned query so search results are consistent
PagingResults<String> pagedResults = getAuthorityService().getAuthorities(AuthorityType.GROUP,
AuthorityService.ZONE_APP_DEFAULT, search, true, true, new PagingRequest(10000));
groups = new LinkedHashSet<String>(pagedResults.getPage());
}
if (includeEveryone)
{
// add the EVERYONE group to the results
groups.addAll(getAuthorityService().getAllAuthorities(AuthorityType.EVERYONE));
}
return groups;
}