From 5970a6e2a2d7d8fd763b1d5c9fd3ef8258c1c6c4 Mon Sep 17 00:00:00 2001 From: Jens L Date: Sun, 23 Apr 2023 19:10:22 +0300 Subject: [PATCH] events: always run policies for notification rules even if no group is selected (#5353) Signed-off-by: Jens Langhammer --- authentik/events/tasks.py | 8 ++++---- website/docs/events/notifications.md | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/authentik/events/tasks.py b/authentik/events/tasks.py index 2918efc73..9c00860f8 100644 --- a/authentik/events/tasks.py +++ b/authentik/events/tasks.py @@ -57,10 +57,6 @@ def event_trigger_handler(event_uuid: str, trigger_name: str): LOGGER.debug("e(trigger): attempting to prevent infinite loop", trigger=trigger) return - if not trigger.group: - LOGGER.debug("e(trigger): trigger has no group", trigger=trigger) - return - LOGGER.debug("e(trigger): checking if trigger applies", trigger=trigger) try: user = User.objects.filter(pk=event.user.get("pk")).first() or get_anonymous_user() @@ -77,6 +73,10 @@ def event_trigger_handler(event_uuid: str, trigger_name: str): if not result.passing: return + if not trigger.group: + LOGGER.debug("e(trigger): trigger has no group", trigger=trigger) + return + LOGGER.debug("e(trigger): event trigger matched", trigger=trigger) # Create the notification objects for transport in trigger.transports.all(): diff --git a/website/docs/events/notifications.md b/website/docs/events/notifications.md index b11da9014..40b4c55d7 100644 --- a/website/docs/events/notifications.md +++ b/website/docs/events/notifications.md @@ -31,6 +31,10 @@ After you've created the policies to match the events you want, create a "Notifi You have to select which group the generated notification should be sent to. If left empty, the rule will be disabled. +:::info +Before authentik 2023.5, when no group is selected, policies bound to the rule are not executed. Starting with authentik 2023.5, policies are executed even when no group is selected. +::: + You also have to select which transports should be used to send the notification. A transport with the name "default-email-transport" is created by default. This transport will use the [global email configuration](../installation/docker-compose#email-configuration-optional-but-recommended).