forked from DGNum/gestioCOF
Change ldap query behaviour if multiple inputs
It is now consistent with the other lookups over the User database
This commit is contained in:
parent
dc50a23b10
commit
74f0b63e96
2 changed files with 4 additions and 4 deletions
|
@ -56,8 +56,8 @@ def autocomplete(request):
|
||||||
# Fetching data from the SPI
|
# Fetching data from the SPI
|
||||||
if hasattr(settings, 'LDAP_SERVER_URL'):
|
if hasattr(settings, 'LDAP_SERVER_URL'):
|
||||||
# Fetching
|
# Fetching
|
||||||
ldap_query = '(|{:s})'.format(''.join(
|
ldap_query = '(&{:s})'.format(''.join(
|
||||||
'(cn=*{bit:s}*)(uid=*{bit:s}*)'.format(bit=bit)
|
'(|(cn=*{bit:s}*)(uid=*{bit:s}*))'.format(bit=bit)
|
||||||
for bit in bits if bit.isalnum()
|
for bit in bits if bit.isalnum()
|
||||||
))
|
))
|
||||||
if ldap_query != "(|)":
|
if ldap_query != "(|)":
|
||||||
|
|
|
@ -75,8 +75,8 @@ def account_create(request):
|
||||||
# Fetching data from the SPI
|
# Fetching data from the SPI
|
||||||
if hasattr(settings, 'LDAP_SERVER_URL'):
|
if hasattr(settings, 'LDAP_SERVER_URL'):
|
||||||
# Fetching
|
# Fetching
|
||||||
ldap_query = '(|{:s})'.format(''.join(
|
ldap_query = '(&{:s})'.format(''.join(
|
||||||
'(cn=*{bit:s}*)(uid=*{bit:s}*)'.format(bit=word)
|
'(|(cn=*{bit:s}*)(uid=*{bit:s}*))'.format(bit=word)
|
||||||
for word in search_words if word.isalnum()
|
for word in search_words if word.isalnum()
|
||||||
))
|
))
|
||||||
if ldap_query != "(|)":
|
if ldap_query != "(|)":
|
||||||
|
|
Loading…
Reference in a new issue