From dd2e4b23166eab75a497c15f9bed39b0cc096b28 Mon Sep 17 00:00:00 2001 From: shekhar16 Date: Fri, 22 Nov 2024 00:35:45 +0530 Subject: [PATCH] fix(oxtrust): user searching is case sensitive for postgres in orm layer Signed-off-by: shekhar16 --- .../org/gluu/persist/sql/impl/SqlFilterConverter.java | 3 +++ .../main/java/org/gluu/oxtrust/service/PersonService.java | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/oxOrm/sql/src/main/java/org/gluu/persist/sql/impl/SqlFilterConverter.java b/oxOrm/sql/src/main/java/org/gluu/persist/sql/impl/SqlFilterConverter.java index cd352458..b19e538a 100644 --- a/oxOrm/sql/src/main/java/org/gluu/persist/sql/impl/SqlFilterConverter.java +++ b/oxOrm/sql/src/main/java/org/gluu/persist/sql/impl/SqlFilterConverter.java @@ -351,6 +351,9 @@ private ConvertedExpression convertToSqlFilterImpl(TableMapping tableMapping, Fi } } else { expression = columnExpression; + if (SupportedDbType.POSTGRESQL == this.dbType) { + ConvertedExpression.build(ExpressionUtils.toLower((Expression) expression), null); + } } return ConvertedExpression.build(Expressions.booleanOperation(Ops.LIKE, expression, Expressions.constant(like.toString())), jsonAttributes); diff --git a/oxTrust/service/src/main/java/org/gluu/oxtrust/service/PersonService.java b/oxTrust/service/src/main/java/org/gluu/oxtrust/service/PersonService.java index 03ebb9af..31b3a536 100644 --- a/oxTrust/service/src/main/java/org/gluu/oxtrust/service/PersonService.java +++ b/oxTrust/service/src/main/java/org/gluu/oxtrust/service/PersonService.java @@ -226,11 +226,11 @@ private Filter buildFilter(String pattern) { private Filter buildFilterForList(String pattern) { String[] targetArray = new String[] { pattern.toLowerCase() }; - Filter uidFilter = Filter.createSubstringFilter(Filter.createLowercaseFilter(OxConstants.UID), null, targetArray, null); - Filter mailFilter = Filter.createSubstringFilter(Filter.createLowercaseFilter(OxTrustConstants.mail), null, targetArray, null); - Filter nameFilter = Filter.createSubstringFilter(Filter.createLowercaseFilter(OxTrustConstants.displayName), null, targetArray, null); + Filter uidFilter = Filter.createSubstringFilter(OxConstants.UID, null, targetArray, null); + Filter mailFilter = Filter.createSubstringFilter(OxTrustConstants.mail, null, targetArray, null); + Filter nameFilter = Filter.createSubstringFilter(OxTrustConstants.displayName, null, targetArray, null); - Filter snFilter = Filter.createSubstringFilter(Filter.createLowercaseFilter(OxTrustConstants.sn), null, targetArray, null); + Filter snFilter = Filter.createSubstringFilter(OxTrustConstants.sn, null, targetArray, null); Filter searchFilter = Filter.createORFilter(uidFilter, mailFilter, nameFilter, snFilter); return searchFilter; }