Fixes for ALFCOM-2910 and ALFCOM-2986

- Also fixes an underlying issue where RepositoryAuthenticationDao.getUserOrNull() method cannot handle username's containing quotes during the Lucene based lookup

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14841 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2009-06-23 08:29:16 +00:00
parent 2d45a887c0
commit a8843c3374

View File

@@ -57,6 +57,7 @@ import org.alfresco.service.namespace.NamespacePrefixResolver;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.service.namespace.RegexQNamePattern;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.util.StringUtils;
public class RepositoryAuthenticationDao implements MutableAuthenticationDao public class RepositoryAuthenticationDao implements MutableAuthenticationDao
{ {
@@ -152,18 +153,14 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
public NodeRef getUserOrNull(String searchUserName) public NodeRef getUserOrNull(String searchUserName)
{ {
if (searchUserName == null) if (searchUserName == null || searchUserName.length() == 0)
{
return null;
}
if (searchUserName.length() == 0)
{ {
return null; return null;
} }
SearchParameters sp = new SearchParameters(); SearchParameters sp = new SearchParameters();
sp.setLanguage(SearchService.LANGUAGE_LUCENE); sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery("@usr\\:username:\"" + searchUserName + "\""); sp.setQuery("@usr\\:username:\"" + StringUtils.delete(searchUserName, "\"") + "\"");
try try
{ {