Browse Source

Ajusta detalhes de permissao

pull/506/head
Eduardo Calil 9 years ago
parent
commit
3d071fd501
  1. 9
      sapl/base/templatetags/common_tags.py
  2. 3
      sapl/templates/base.html
  3. 2
      sapl/utils.py

9
sapl/base/templatetags/common_tags.py

@ -77,3 +77,12 @@ def get_delete_perm(value, arg):
can_delete = '.delete_' + nome_model can_delete = '.delete_' + nome_model
return perm.__contains__(nome_app + can_delete) return perm.__contains__(nome_app + can_delete)
@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 i18n staticfiles sass_tags menus %}
{% load common_tags %}
<!DOCTYPE html> <!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <!--[if gt IE 8]><!-->
@ -97,7 +98,7 @@
<!-- <li class="nav__sub-item"><a class="nav__sub-link" href="#">Índice de Assuntos</a></li> --> <!-- <li class="nav__sub-item"><a class="nav__sub-link" href="#">Índice de Assuntos</a></li> -->
</ul> </ul>
</li> </li>
{% if user.is_superuser %} {% if user|ver_menu_sistema_perm %}
<li class="dropdown"> <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> <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"> <ul class="dropdown-menu">

2
sapl/utils.py

@ -299,7 +299,7 @@ def permissoes_painel():
def permissao_tb_aux(self): def permissao_tb_aux(self):
u = self.request.user 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 return True
else: else:
return False return False

Loading…
Cancel
Save