policy(major): simplify PolicyEngine API, add flag to ignore cache for debug purposes

This commit is contained in:
Langhammer, Jens
2019-10-15 15:44:59 +02:00
parent 13f4ea0b8b
commit d4cb1a98c7
10 changed files with 23 additions and 31 deletions

View File

@ -42,7 +42,7 @@ class PolicyProcess(Process):
if self.policy.negate:
policy_result.passing = not policy_result.passing
LOGGER.debug("Got result", policy=self.policy, result=policy_result,
process="PolicyProcess")
process="PolicyProcess", passing=policy_result.passing, user=self.request.user)
key = cache_key(self.policy, self.request.user)
cache.set(key, policy_result)
LOGGER.debug("Cached policy evaluation", key=key)