summaryrefslogtreecommitdiffstats
path: root/bitvend/auth.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitvend/auth.py')
-rw-r--r--bitvend/auth.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/bitvend/auth.py b/bitvend/auth.py
index f7486fe..8e1ff26 100644
--- a/bitvend/auth.py
+++ b/bitvend/auth.py
@@ -40,7 +40,9 @@ def cap_check(capability, user=None):
return False
user = user or current_user.get_id()
- cached_cap = session.get('_caps', {}).get(capability, (False, 0))
+
+ cache_key = '{}-{}'.format(user, capability)
+ cached_cap = session.get('_caps', {}).get(cache_key, (False, 0))
if cached_cap[1] > time.time():
return cached_cap[0]
@@ -52,7 +54,7 @@ def cap_check(capability, user=None):
if '_caps' not in session:
session['_caps'] = {}
- session['_caps'][capability] = \
+ session['_caps'][cache_key] = \
(allowed, time.time() + current_app.config.get('CAP_TTL', 3600))
return allowed