Add email to ldap autocomplete

This commit is contained in:
Ludovic Stephan 2020-08-03 14:30:12 +02:00
parent 9110e5b185
commit 910536c6d3

View file

@ -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
]