From 8d1d418f6745b5516db87a63482f8292cf8d39b9 Mon Sep 17 00:00:00 2001 From: prathabanKavin Date: Tue, 7 Nov 2023 21:05:34 +0530 Subject: [PATCH] Fix user search by partial filters --- .../api/jaxrs/service/impl/UserManagementServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java index cdf3fb8342b..6d34b2bc6de 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java @@ -480,7 +480,7 @@ public class UserManagementServiceImpl implements UserManagementService { try { if (StringUtils.isNotEmpty(username)) { - commonUsers = getUserList(null, username); + commonUsers = getUserList(null, "*" + username + "*"); } if (commonUsers != null) { commonUsers.remove(Constants.APIM_RESERVED_USER); @@ -488,7 +488,7 @@ public class UserManagementServiceImpl implements UserManagementService { } if (!skipSearch(commonUsers) && StringUtils.isNotEmpty(firstName)) { - tempList = getUserList(Constants.USER_CLAIM_FIRST_NAME, firstName); + tempList = getUserList(Constants.USER_CLAIM_FIRST_NAME, "*" + firstName + "*"); if (commonUsers == null) { commonUsers = tempList; } else { @@ -497,7 +497,7 @@ public class UserManagementServiceImpl implements UserManagementService { } if (!skipSearch(commonUsers) && StringUtils.isNotEmpty(lastName)) { - tempList = getUserList(Constants.USER_CLAIM_LAST_NAME, lastName); + tempList = getUserList(Constants.USER_CLAIM_LAST_NAME, "*" + lastName + "*"); if (commonUsers == null || commonUsers.size() == 0) { commonUsers = tempList; } else { @@ -506,7 +506,7 @@ public class UserManagementServiceImpl implements UserManagementService { } if (!skipSearch(commonUsers) && StringUtils.isNotEmpty(emailAddress)) { - tempList = getUserList(Constants.USER_CLAIM_EMAIL_ADDRESS, emailAddress); + tempList = getUserList(Constants.USER_CLAIM_EMAIL_ADDRESS, "*" + emailAddress + "*"); if (commonUsers == null || commonUsers.size() == 0) { commonUsers = tempList; } else {