From 0fef44e5b2626913acc6af4798d06f1db91537ef Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Thu, 30 Jun 2016 11:45:01 -0300 Subject: [PATCH] Coloca o menu sistema visivel ao operador geral --- sapl/base/templatetags/common_tags.py | 10 ++++++++-- sapl/templates/base.html | 3 ++- sapl/utils.py | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sapl/base/templatetags/common_tags.py b/sapl/base/templatetags/common_tags.py index 6d4754461..4f8370eac 100644 --- a/sapl/base/templatetags/common_tags.py +++ b/sapl/base/templatetags/common_tags.py @@ -78,5 +78,11 @@ def get_delete_perm(value, arg): return perm.__contains__(nome_app + can_delete) -# view.__class__.model._meta.app_label -> nome do app -# context.getcontext.get('view').__class__.model.__name__.lower() -> nome do model + +@register.filter +def ver_menu_sistema_perm(value): + u = value + if u.groups.filter(name='Operador Geral').exists() or u.is_superuser: + return True + else: + return False diff --git a/sapl/templates/base.html b/sapl/templates/base.html index 260dc5fec..05eba9d86 100644 --- a/sapl/templates/base.html +++ b/sapl/templates/base.html @@ -1,4 +1,5 @@ {% load i18n staticfiles sass_tags menus %} +{% load common_tags %} @@ -89,7 +90,7 @@ - {% if user.is_superuser %} + {% if user|ver_menu_sistema_perm %}