From eef111bcfd0b720c86540e1053da462b60196c47 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 14 Jan 2021 17:21:12 +0100 Subject: [PATCH] events: disable policy cache for trigger --- authentik/events/tasks.py | 9 ++++++--- web/src/api/Groups.ts | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/authentik/events/tasks.py b/authentik/events/tasks.py index d86d16555..1eed4a28d 100644 --- a/authentik/events/tasks.py +++ b/authentik/events/tasks.py @@ -36,23 +36,26 @@ def event_trigger_handler(event_uuid: str, trigger_name: str): if trigger.policies.filter(policy_uuid=policy_uuid).exists(): # Event has been created by a policy that is attached # to this trigger. To prevent infinite loops, we stop here - LOGGER.debug("e(trigger): attempting to prevent infinite loop") + LOGGER.debug( + "e(trigger): attempting to prevent infinite loop", trigger=trigger + ) return if not trigger.group: - LOGGER.debug("e(trigger): trigger has no group") + LOGGER.debug("e(trigger): trigger has no group", trigger=trigger) return policy_engine = PolicyEngine(trigger, get_anonymous_user()) policy_engine.mode = PolicyEngineMode.MODE_OR policy_engine.empty_result = False + policy_engine.use_cache = False policy_engine.request.context["event"] = event policy_engine.build() result = policy_engine.result if not result.passing: return - LOGGER.debug("e(trigger): event trigger matched") + LOGGER.debug("e(trigger): event trigger matched", trigger=trigger) # Create the notification objects for user in trigger.group.users.all(): notification = Notification.objects.create( diff --git a/web/src/api/Groups.ts b/web/src/api/Groups.ts index 666635924..36b73b48a 100644 --- a/web/src/api/Groups.ts +++ b/web/src/api/Groups.ts @@ -1,9 +1,11 @@ +import { EventContext } from "./Events"; + export class Group { group_uuid: string; name: string; is_superuser: boolean; - attributes: object; + attributes: EventContext; parent?: Group; constructor() {