Skip to content
Snippets Groups Projects
Verified Commit 423f4da7 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Guess uid field from first search query

We expect it to be equal or all searches. If not, there is really
nothing that can be done for that LDAP admin.

Related to AlekSIS#249
parent ceafbf6b
No related branches found
No related tags found
1 merge request!13Support LDAPSearchUnion now used in core
......@@ -319,9 +319,9 @@ def mass_ldap_import():
group_dict = {obj.ldap_dn: obj for obj in group_objects}
# Guess LDAP username field from user filter
uid_field = re.search(r"([a-zA-Z]+)=%\(user\)s", backend.settings.USER_SEARCH.filterstr).group(
1
)
uid_field = re.search(
r"([a-zA-Z]+)=%\(user\)s", backend.settings.USER_SEARCH.searches[0].filterstr
).group(1)
# Synchronise user data for all found users
ldap_users = backend.settings.USER_SEARCH.execute(connection, {"user": "*"}, escape=False)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment