From 910536c6d3257252306c6be33acfb7697ac8b4fb Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Mon, 3 Aug 2020 14:30:12 +0200 Subject: [PATCH] Add email to ldap autocomplete --- shared/autocomplete.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared/autocomplete.py b/shared/autocomplete.py index 564a6da7..e0fa8413 100644 --- a/shared/autocomplete.py +++ b/shared/autocomplete.py @@ -129,13 +129,13 @@ class ModelSearch(SearchUnit): # LDAP search # --- -Clipper = namedtuple("Clipper", ["clipper", "fullname"]) +Clipper = namedtuple("Clipper", ["clipper", "fullname", "mail"]) class LDAPSearch(SearchUnit): ldap_server_url = getattr(settings, "LDAP_SERVER_URL", None) domain_component = "dc=spi,dc=ens,dc=fr" - search_fields = ["cn", "uid"] + search_fields = ["cn", "uid", "mail"] verbose_name = _("Comptes clippers") @@ -178,6 +178,7 @@ class LDAPSearch(SearchUnit): Clipper( clipper=attrs["uid"][0].decode("utf-8"), fullname=attrs["cn"][0].decode("utf-8"), + mail=attrs["mail"][0].decode("utf-8"), ) for (_, attrs) in res ]