diff --git a/sugoi-api-ldap-store-provider/src/main/java/fr/insee/sugoi/store/ldap/LdapReaderStore.java b/sugoi-api-ldap-store-provider/src/main/java/fr/insee/sugoi/store/ldap/LdapReaderStore.java index 6258470a..de49eec3 100644 --- a/sugoi-api-ldap-store-provider/src/main/java/fr/insee/sugoi/store/ldap/LdapReaderStore.java +++ b/sugoi-api-ldap-store-provider/src/main/java/fr/insee/sugoi/store/ldap/LdapReaderStore.java @@ -308,14 +308,15 @@ private Filter getFilterFromObject( private Filter getFilterFromObject( M object, LdapMapper mapper, String searchType, boolean encodeCommonNameWildcard) { Assert.isTrue( - searchType.equals("AND") || searchType.equals("OR"), "Search type should be AND or OR."); + searchType.equalsIgnoreCase("AND") || searchType.equalsIgnoreCase("OR"), + "Search type should be AND or OR."); List attributes = mapper.createAttributesForFilter(object); List attributeListFilter = getAttributesFilters(attributes, encodeCommonNameWildcard); List objectClassListFilter = getObjectClassFilters(attributes); if (!objectClassListFilter.isEmpty() && attributeListFilter.isEmpty()) { return LdapFilter.and(objectClassListFilter); } else if (objectClassListFilter.isEmpty() && !attributeListFilter.isEmpty()) { - return searchType.equals("AND") + return searchType.equalsIgnoreCase("OR") ? LdapFilter.or(attributeListFilter) : LdapFilter.and(attributeListFilter); } else {