Forums de discussion

Custom field parameters ignored by UserLocalServiceUtil.search()

thumbnail
Peter Svehla, modifié il y a 9 années.

Custom field parameters ignored by UserLocalServiceUtil.search()

New Member Publications: 4 Date d'inscription: 19/03/12 Publications récentes
Hi,

I'm trying to retrieve a user record based on a custom field search (indexed):

long companyId = 10154;

String dn = "CN=Fred Smith,OU=Corporate,DC=company,DC=com";
LinkedHashMap<string, object> params = new LinkedHashMap<string, object>();
params.put("distinguishedName", dn);
Sort sort = new Sort("prefName", Sort.STRING_TYPE, true);
Hits users = UserLocalServiceUtil.search(companyId, null, WorkflowConstants.STATUS_ANY, params, QueryUtil.ALL_POS, QueryUtil.ALL_POS, sort);
out.println(users.toList());</string,></string,>


The trouble is that the search returns all the users in the system, not just the user with the desired dn.

I get the same result on 6.1.20 and 6.2.0.4, so I'm thinking it's more likely that the problem is with my understanding of the API than a bug in Liferay.

Can anyone spot what I've done wrong?

Thanks,
Peter.