Browse Source

Coloca o menu sistema visivel ao operador geral

pull/505/head
Eduardo Calil 9 years ago
parent
commit
0d0bc0a2df
  1. 10
      sapl/base/templatetags/common_tags.py
  2. 3
      sapl/templates/base.html
  3. 2
      sapl/utils.py

10
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

3
sapl/templates/base.html

@ -1,4 +1,5 @@
{% load i18n staticfiles sass_tags menus %}
{% load common_tags %}
<!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!-->
@ -89,7 +90,7 @@
<!-- <li class="nav__sub-item"><a class="nav__sub-link" href="#">Índice de Assuntos</a></li> -->
</ul>
</li>
{% if user.is_superuser %}
{% if user|ver_menu_sistema_perm %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Sistema <span class="caret"></span></a>
<ul class="dropdown-menu">

2
sapl/utils.py

@ -299,7 +299,7 @@ def permissoes_painel():
def permissao_tb_aux(self):
u = self.request.user
if u.groups.filter(name='Operador Geral').exists():
if u.groups.filter(name='Operador Geral').exists() or u.is_superuser:
return True
else:
return False

Loading…
Cancel
Save