mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-2217 Filtering with special characters - fix backslash.
+review RM git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@106011 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -23,14 +23,14 @@ import static org.alfresco.model.ContentModel.PROP_FIRSTNAME;
|
|||||||
import static org.alfresco.model.ContentModel.PROP_LASTNAME;
|
import static org.alfresco.model.ContentModel.PROP_LASTNAME;
|
||||||
import static org.alfresco.model.ContentModel.PROP_USERNAME;
|
import static org.alfresco.model.ContentModel.PROP_USERNAME;
|
||||||
|
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.alfresco.util.Pair;
|
|
||||||
import org.alfresco.util.ParameterCheck;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.util.Pair;
|
||||||
|
import org.alfresco.util.ParameterCheck;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configurable options to be used when querying for users by {@link SecurityClearance}.
|
* Configurable options to be used when querying for users by {@link SecurityClearance}.
|
||||||
*
|
*
|
||||||
@@ -39,7 +39,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public final class UserQueryParams
|
public final class UserQueryParams
|
||||||
{
|
{
|
||||||
// Required parameter. No default value. This is the username fragment.
|
/** Required parameter. No default value. This is the username fragment. */
|
||||||
private final String searchTerm;
|
private final String searchTerm;
|
||||||
|
|
||||||
// These configurable parameters have default values.
|
// These configurable parameters have default values.
|
||||||
@@ -48,10 +48,16 @@ public final class UserQueryParams
|
|||||||
private int skipCount = 0;
|
private int skipCount = 0;
|
||||||
private int maxItems = 10;
|
private int maxItems = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new object for searching for people.
|
||||||
|
*
|
||||||
|
* @param searchTerm The unescaped string to search for in the people service.
|
||||||
|
*/
|
||||||
public UserQueryParams(final String searchTerm)
|
public UserQueryParams(final String searchTerm)
|
||||||
{
|
{
|
||||||
// A 'null' value here is allowed.
|
ParameterCheck.mandatory("searchTerm", searchTerm);
|
||||||
this.searchTerm = searchTerm;
|
// Escape backslashes before using in the query. (The person service does not do this for us)
|
||||||
|
this.searchTerm = searchTerm.replace("\\", "\\\\");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the skip count required for the query. */
|
/** Sets the skip count required for the query. */
|
||||||
|
@@ -25,7 +25,6 @@ import static org.mockito.Matchers.anyString;
|
|||||||
import static org.mockito.Mockito.doReturn;
|
import static org.mockito.Mockito.doReturn;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
@@ -119,7 +118,7 @@ public class UserSecurityClearanceGetUnitTest extends BaseWebScriptUnitTest
|
|||||||
}
|
}
|
||||||
}).when(mockedSecurityClearanceService).getUsersSecurityClearance(any(UserQueryParams.class));
|
}).when(mockedSecurityClearanceService).getUsersSecurityClearance(any(UserQueryParams.class));
|
||||||
|
|
||||||
JSONObject response = executeJSONWebScript(new HashMap<String, String>());
|
JSONObject response = executeJSONWebScript(buildParameters("nameFilter", "userName"));
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
|
|
||||||
JSONObject data = response.getJSONObject("data");
|
JSONObject data = response.getJSONObject("data");
|
||||||
@@ -188,7 +187,7 @@ public class UserSecurityClearanceGetUnitTest extends BaseWebScriptUnitTest
|
|||||||
}
|
}
|
||||||
}).when(mockedSecurityClearanceService).getUsersSecurityClearance(any(UserQueryParams.class));
|
}).when(mockedSecurityClearanceService).getUsersSecurityClearance(any(UserQueryParams.class));
|
||||||
|
|
||||||
JSONObject response = executeJSONWebScript(buildParameters("pageSize", Integer.toString(pageSize), "startIndex", Integer.toString(startIndex)));
|
JSONObject response = executeJSONWebScript(buildParameters("nameFilter", "userName", "pageSize", Integer.toString(pageSize), "startIndex", Integer.toString(startIndex)));
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
Reference in New Issue
Block a user