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

Match username to find linked person instead of user object

Pitfall: If passed an unsaved user object, this user object has an id of
NULL, so all person objects with as NULL foreign key on user match.
parent c1b82bc6
No related branches found
No related tags found
1 merge request!4Resolve "Mass import of users"
...@@ -141,7 +141,7 @@ def ldap_sync_from_user(user, dn, attrs): ...@@ -141,7 +141,7 @@ def ldap_sync_from_user(user, dn, attrs):
Person = apps.get_model("core", "Person") Person = apps.get_model("core", "Person")
# Check if there is an existing person connected to the user. # Check if there is an existing person connected to the user.
if Person.objects.filter(user=user).exists(): if Person.objects.filter(user__username=user.username).exists():
person = user.person person = user.person
created = False created = False
logger.info("Existing person %s already linked to user %s" % (str(person), user.username)) logger.info("Existing person %s already linked to user %s" % (str(person), user.username))
......
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