Browse Source

Ajusta detalhes de permissao

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

9
sapl/base/templatetags/common_tags.py

@ -86,3 +86,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">

Loading…
Cancel
Save