😏
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
diff --git a/policy.py b/policy.py
|
||||
--- a/policy.py
|
||||
+++ b/policy.py
|
||||
@@ -5,6 +5,8 @@ class Policy:
|
||||
|
||||
def set_flag(self, name, enabled):
|
||||
self.flags[name] = bool(enabled)
|
||||
+ if enabled:
|
||||
+ self._decision_cache.clear()
|
||||
|
||||
def allows(self, user_id, flag):
|
||||
key = (user_id, flag)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
diff --git a/policy.py b/policy.py
|
||||
--- a/policy.py
|
||||
+++ b/policy.py
|
||||
@@ -5,6 +5,8 @@ class Policy:
|
||||
|
||||
def set_flag(self, name, enabled):
|
||||
self.flags[name] = bool(enabled)
|
||||
+ for key in [key for key in self._decision_cache if key[0] == name]:
|
||||
+ del self._decision_cache[key]
|
||||
|
||||
def allows(self, user_id, flag):
|
||||
key = (user_id, flag)
|
||||
Reference in New Issue
Block a user