core: fallback to empty user object for PropertyMappingEvaluator

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-10-18 21:41:00 +02:00
parent 0efee2a660
commit 6bff6a2a1a

View file

@ -4,7 +4,6 @@ from typing import Optional
from django.db.models import Model from django.db.models import Model
from django.http import HttpRequest from django.http import HttpRequest
from guardian.utils import get_anonymous_user
from authentik.core.models import User from authentik.core.models import User
from authentik.events.models import Event, EventAction from authentik.events.models import Event, EventAction
@ -27,7 +26,7 @@ class PropertyMappingEvaluator(BaseEvaluator):
else: else:
_filename = str(model) _filename = str(model)
super().__init__(filename=_filename) super().__init__(filename=_filename)
req = PolicyRequest(user=get_anonymous_user()) req = PolicyRequest(user=User())
req.obj = model req.obj = model
if user: if user:
req.user = user req.user = user