From 74f0b63e9641504b25c1c865a12fdee6d3fb0ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Sun, 19 Mar 2017 15:06:41 +0000 Subject: [PATCH] Change ldap query behaviour if multiple inputs It is now consistent with the other lookups over the User database --- gestioncof/autocomplete.py | 4 ++-- kfet/autocomplete.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gestioncof/autocomplete.py b/gestioncof/autocomplete.py index 7caea48b..1146e1c0 100644 --- a/gestioncof/autocomplete.py +++ b/gestioncof/autocomplete.py @@ -56,8 +56,8 @@ def autocomplete(request): # Fetching data from the SPI if hasattr(settings, 'LDAP_SERVER_URL'): # Fetching - ldap_query = '(|{:s})'.format(''.join( - '(cn=*{bit:s}*)(uid=*{bit:s}*)'.format(bit=bit) + ldap_query = '(&{:s})'.format(''.join( + '(|(cn=*{bit:s}*)(uid=*{bit:s}*))'.format(bit=bit) for bit in bits if bit.isalnum() )) if ldap_query != "(|)": diff --git a/kfet/autocomplete.py b/kfet/autocomplete.py index d8582ccb..2dd3c32f 100644 --- a/kfet/autocomplete.py +++ b/kfet/autocomplete.py @@ -75,8 +75,8 @@ def account_create(request): # Fetching data from the SPI if hasattr(settings, 'LDAP_SERVER_URL'): # Fetching - ldap_query = '(|{:s})'.format(''.join( - '(cn=*{bit:s}*)(uid=*{bit:s}*)'.format(bit=word) + ldap_query = '(&{:s})'.format(''.join( + '(|(cn=*{bit:s}*)(uid=*{bit:s}*))'.format(bit=word) for word in search_words if word.isalnum() )) if ldap_query != "(|)":