@@ -39,7 +39,7 @@
{% endif %}
{% endblock editions %}
{% block detail_content %}
- {% if user == object.autor.user %}
+ {% if user in object.autor.operadores.all %}
diff --git a/sapl/templates/menu_tabelas_auxiliares.yaml b/sapl/templates/menu_tabelas_auxiliares.yaml
index 6c159be40..7241509cb 100644
--- a/sapl/templates/menu_tabelas_auxiliares.yaml
+++ b/sapl/templates/menu_tabelas_auxiliares.yaml
@@ -8,15 +8,12 @@
- title: {% trans 'Configurações da Aplicação' %}
url: sapl.base:appconfig_list
css_class: btn btn-link
- - title: {% trans 'Pesquisar Autor' %}
- url: sapl.base:pesquisar_autor
- css_class: btn btn-link
- - title: {% trans 'Adicionar Autor' %}
- url: sapl.base:autor_create
- css_class: btn btn-link
- title: {% trans 'Tipo de Autor' %}
url: sapl.base:tipoautor_list
css_class: btn btn-link
+ - title: {% trans 'Autores' %}
+ url: sapl.base:autor_list
+ css_class: btn btn-link
{% if not sapl_as_sapn%}
- title: {% trans 'Módulo Parlamentares' %}
css_class: head_title
diff --git a/sapl/utils.py b/sapl/utils.py
index a588d8a3c..1acd472ae 100644
--- a/sapl/utils.py
+++ b/sapl/utils.py
@@ -28,7 +28,6 @@ from django.db import models
from django.db.models import Q
from django.forms import BaseForm
from django.forms.widgets import SplitDateTimeWidget
-from django.urls.base import clear_url_caches
from django.utils import six, timezone
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
@@ -51,6 +50,32 @@ from sapl.settings import MAX_DOC_UPLOAD_SIZE
SEPARADOR_HASH_PROPOSICAO = 'K'
+def groups_remove_user(user, groups_name):
+ from django.contrib.auth.models import Group
+
+ if not isinstance(groups_name, list):
+ groups_name = [groups_name, ]
+ for group_name in groups_name:
+ if not group_name or not user.groups.filter(
+ name=group_name).exists():
+ continue
+ g = Group.objects.get_or_create(name=group_name)[0]
+ user.groups.remove(g)
+
+
+def groups_add_user(user, groups_name):
+ from django.contrib.auth.models import Group
+
+ if not isinstance(groups_name, list):
+ groups_name = [groups_name, ]
+ for group_name in groups_name:
+ if not group_name or user.groups.filter(
+ name=group_name).exists():
+ continue
+ g = Group.objects.get_or_create(name=group_name)[0]
+ user.groups.add(g)
+
+
def num_materias_por_tipo(qs, attr_tipo='tipo'):
"""
:argument um QuerySet em MateriaLegislativa