summaryrefslogtreecommitdiffstats
path: root/bitvend
diff options
context:
space:
mode:
authorPiotr Dobrowolski <admin@tastycode.pl>2017-04-21 17:46:06 +0200
committerPiotr Dobrowolski <admin@tastycode.pl>2017-04-21 17:46:06 +0200
commit13e62699690e98ec13cf68da0c5672f647ca2306 (patch)
tree2cbd8619056381f8b0b6c17f981487edc835ee84 /bitvend
parentca53984dbb65e6df80e47d4f4cf28aef07ef175d (diff)
downloadbitvend-13e62699690e98ec13cf68da0c5672f647ca2306.tar.gz
bitvend-13e62699690e98ec13cf68da0c5672f647ca2306.tar.bz2
bitvend-13e62699690e98ec13cf68da0c5672f647ca2306.tar.xz
bitvend-13e62699690e98ec13cf68da0c5672f647ca2306.zip
auth: Fix capability cache for other users...
Diffstat (limited to 'bitvend')
-rw-r--r--bitvend/auth.py6
-rw-r--r--bitvend/templates/base.html2
2 files changed, 5 insertions, 3 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
diff --git a/bitvend/templates/base.html b/bitvend/templates/base.html
index 67aaf34..dd799f9 100644
--- a/bitvend/templates/base.html
+++ b/bitvend/templates/base.html
@@ -40,7 +40,7 @@
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
- <a href="../" class="navbar-brand">bitvend</a>
+ <a href="{{ url_for('bitvend.index') }}" class="navbar-brand">bitvend</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main">
<span class="icon-bar"></span>
<span class="icon-bar"></span>