fix 'circular' import

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt
2025-06-11 14:28:04 +02:00
parent 7f8f7376e0
commit 75d19bfe76

View File

@ -13,7 +13,6 @@ from rest_framework.request import Request
from authentik.core.models import AuthenticatedSession, User
from authentik.core.signals import login_failed, password_changed
from authentik.events.models import Event, EventAction, NotificationRule
from authentik.events.tasks import event_trigger_handler, gdpr_cleanup
from authentik.flows.models import Stage
from authentik.flows.planner import PLAN_CONTEXT_OUTPOST, PLAN_CONTEXT_SOURCE, FlowPlan
from authentik.flows.views.executor import SESSION_KEY_PLAN
@ -112,6 +111,8 @@ def on_password_changed(sender, user: User, password: str, request: HttpRequest
@receiver(post_save, sender=Event)
def event_post_save_notification(sender, instance: Event, **_):
"""Start task to check if any policies trigger an notification on this event"""
from authentik.events.tasks import event_trigger_handler
for trigger in NotificationRule.objects.all():
event_trigger_handler.send(instance.event_uuid, trigger.name)
@ -119,5 +120,7 @@ def event_post_save_notification(sender, instance: Event, **_):
@receiver(pre_delete, sender=User)
def event_user_pre_delete_cleanup(sender, instance: User, **_):
"""If gdpr_compliance is enabled, remove all the user's events"""
from authentik.events.tasks import gdpr_cleanup
if get_current_tenant().gdpr_compliance:
gdpr_cleanup.send(instance.pk)