Skip to content
Snippets Groups Projects
Commit 21d0f9b8 authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Fix to early call of get_site_preferences

parent 737b68cc
No related branches found
No related tags found
No related merge requests found
...@@ -26,5 +26,4 @@ class LDAPConfig(AppConfig): ...@@ -26,5 +26,4 @@ class LDAPConfig(AppConfig):
update_dynamic_preferences() update_dynamic_preferences()
user = get_user_model() user = get_user_model()
if get_site_preferences()["ldap__person_sync_on_login"]: post_save.connect(ldap_sync_user_on_login, sender=user)
post_save.connect(ldap_sync_user_on_login, sender=user)
...@@ -123,6 +123,10 @@ def apply_templates(value, patterns, templates, separator="|"): ...@@ -123,6 +123,10 @@ def apply_templates(value, patterns, templates, separator="|"):
@transaction.atomic @transaction.atomic
def ldap_sync_user_on_login(sender, instance, created, **kwargs): def ldap_sync_user_on_login(sender, instance, created, **kwargs):
"""Synchronise Person meta-data and groups from ldap_user on User update.""" """Synchronise Person meta-data and groups from ldap_user on User update."""
# Check if sync on login is activated
if not get_site_preferences()["ldap__person_sync_on_login"]:
return
# Semaphore to guard recursive saves within this signal # Semaphore to guard recursive saves within this signal
if getattr(instance, "_skip_signal", False): if getattr(instance, "_skip_signal", False):
return return
......
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