This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/sources/ldap/signals.py

15 lines
489 B
Python

"""passbook ldap source signals"""
from django.db.models.signals import post_save
from django.dispatch import receiver
from passbook.sources.ldap.models import LDAPSource
from passbook.sources.ldap.tasks import sync_single
@receiver(post_save, sender=LDAPSource)
# pylint: disable=unused-argument
def sync_ldap_source_on_save(sender, instance: LDAPSource, **_):
"""Ensure that source is synced on save (if enabled)"""
if instance.enabled:
sync_single.delay(instance.pk)