backoffice: do not include strongbox page if support is not enabled

This commit is contained in:
Frédéric Péters 2013-04-03 21:25:20 +02:00
parent 4b0f675617
commit 3712d7d747
1 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,5 @@
from quixote import get_publisher
from qommon.publisher import get_publisher_class, get_request
from qommon.misc import get_cfg
@ -30,7 +32,10 @@ def check_visibility(target):
user = get_request().user
if not user:
return False
admin_role = get_cfg('aq-permissions', {}).get(target.strip('/'), None)
target = target.strip('/')
if target in ('strongbox', ) and not get_publisher().has_site_option(target):
return False
admin_role = get_cfg('aq-permissions', {}).get(target, None)
if not admin_role:
return False
if not (user.is_admin or admin_role in (user.roles or [])):