From a8843c337456b58f96e4751c9d29509398e76320 Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Tue, 23 Jun 2009 08:29:16 +0000 Subject: [PATCH] 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 --- .../authentication/RepositoryAuthenticationDao.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/source/java/org/alfresco/repo/security/authentication/RepositoryAuthenticationDao.java b/source/java/org/alfresco/repo/security/authentication/RepositoryAuthenticationDao.java index ee5b0edd6a..1482aaf0d0 100644 --- a/source/java/org/alfresco/repo/security/authentication/RepositoryAuthenticationDao.java +++ b/source/java/org/alfresco/repo/security/authentication/RepositoryAuthenticationDao.java @@ -57,6 +57,7 @@ import org.alfresco.service.namespace.NamespacePrefixResolver; import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.RegexQNamePattern; import org.springframework.dao.DataAccessException; +import org.springframework.util.StringUtils; public class RepositoryAuthenticationDao implements MutableAuthenticationDao { @@ -152,18 +153,14 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao public NodeRef getUserOrNull(String searchUserName) { - if (searchUserName == null) - { - return null; - } - if (searchUserName.length() == 0) + if (searchUserName == null || searchUserName.length() == 0) { return null; } SearchParameters sp = new SearchParameters(); sp.setLanguage(SearchService.LANGUAGE_LUCENE); - sp.setQuery("@usr\\:username:\"" + searchUserName + "\""); + sp.setQuery("@usr\\:username:\"" + StringUtils.delete(searchUserName, "\"") + "\""); try {