policies: ensure user is set

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-01-14 20:24:46 +01:00
parent 1f038ecee2
commit 143309448e
No known key found for this signature in database

View file

@ -52,6 +52,8 @@ class PolicyEngine:
self.empty_result = True
if not isinstance(pbm, PolicyBindingModel): # pragma: no cover
raise ValueError(f"{pbm} is not instance of PolicyBindingModel")
if not user:
raise ValueError("User must be set")
self.__pbm = pbm
self.request = PolicyRequest(user)
self.request.obj = pbm