Browse Source

Faz a autorizacao do app sessao

pull/505/head
Eduardo Calil 9 years ago
committed by LeandroRoberto
parent
commit
72e5542c73
  1. 12
      sapl/comissoes/views.py
  2. 14
      sapl/materia/views.py
  3. 12
      sapl/norma/views.py
  4. 13
      sapl/parlamentares/views.py
  5. 23
      sapl/protocoloadm/views.py
  6. 162
      sapl/sessao/views.py
  7. 75
      sapl/utils.py

12
sapl/comissoes/views.py

@ -1,27 +1,17 @@
from django.core.urlresolvers import reverse
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.views.generic import ListView
from sapl.crud.base import (Crud, CrudBaseMixin, CrudCreateView,
CrudUpdateView, CrudDeleteView)
from sapl.crud.masterdetail import MasterDetailCrud
from sapl.materia.models import Tramitacao
from sapl.utils import permissoes_comissoes
from .models import (CargoComissao, Comissao, Composicao, Participacao,
Periodo, TipoComissao)
def permissoes_comissoes():
lista_permissoes = []
cts = ContentType.objects.filter(app_label='comissoes')
perms_comissoes = list(Permission.objects.filter(content_type__in=cts))
for p in perms_comissoes:
lista_permissoes.append('comissoes.' + p.codename)
return set(lista_permissoes)
def pegar_url_composicao(pk):
participacao = Participacao.objects.get(id=pk)
comp_pk = participacao.composicao.pk

14
sapl/materia/views.py

@ -5,9 +5,7 @@ from string import ascii_letters, digits
from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML, Button
from django.contrib import messages
from django.contrib.auth.models import Permission
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
@ -24,7 +22,8 @@ from sapl.crud.base import (Crud, CrudBaseMixin, CrudCreateView, CrudListView,
CrudUpdateView, CrudDeleteView, make_pagination)
from sapl.crud.masterdetail import MasterDetailCrud
from sapl.norma.models import LegislacaoCitada
from sapl.utils import autor_label, autor_modal, get_base_url
from sapl.utils import (autor_label, autor_modal, get_base_url,
permissoes_materia)
from .forms import (AcompanhamentoMateriaForm, AnexadaForm, AutoriaForm,
DespachoInicialForm, DocumentoAcessorioForm,
@ -44,15 +43,6 @@ from .models import (AcompanhamentoMateria, Anexada, Autor, Autoria,
AnexadaCrud = Crud.build(Anexada, '')
def permissoes_materia():
lista_permissoes = []
cts = ContentType.objects.filter(app_label='materia')
perms_materia = list(Permission.objects.filter(content_type__in=cts))
for p in perms_materia:
lista_permissoes.append('materia.' + p.codename)
return set(lista_permissoes)
class OrigemCrud(Crud):
model = Origem
help_path = 'origem'

12
sapl/norma/views.py

@ -1,14 +1,13 @@
from datetime import datetime
from django.contrib.auth.models import Permission
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.contenttypes.models import ContentType
from django.shortcuts import redirect
from django.views.generic import FormView, ListView
from sapl.compilacao.views import IntegracaoTaView
from sapl.crud.base import (Crud, CrudBaseMixin, CrudCreateView,
CrudDeleteView, CrudUpdateView, make_pagination)
from sapl.utils import permissoes_norma
from .forms import NormaJuridicaForm, NormaJuridicaPesquisaForm
from .models import (AssuntoNorma, LegislacaoCitada, NormaJuridica,
@ -17,15 +16,6 @@ from .models import (AssuntoNorma, LegislacaoCitada, NormaJuridica,
LegislacaoCitadaCrud = Crud.build(LegislacaoCitada, '')
def permissoes_norma():
lista_permissoes = []
cts = ContentType.objects.filter(app_label='norma')
perms_norma = list(Permission.objects.filter(content_type__in=cts))
for p in perms_norma:
lista_permissoes.append('norma.' + p.codename)
return set(lista_permissoes)
class AssuntoNormaCrud(Crud):
model = AssuntoNorma
help_path = 'assunto_norma_juridica'

13
sapl/parlamentares/views.py

@ -1,7 +1,5 @@
from django.contrib import messages
from django.contrib.auth.models import Permission
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse_lazy
from django.shortcuts import redirect
from django.utils.datastructures import MultiValueDictKeyError
@ -12,6 +10,8 @@ from sapl.crud.base import (Crud, CrudCreateView, CrudListView, CrudUpdateView,
CrudBaseMixin, CrudDeleteView)
from sapl.crud.masterdetail import MasterDetailCrud
from sapl.utils import permissoes_parlamentares
from .forms import (ComposicaoColigacaoForm, FiliacaoForm, LegislaturaForm,
ParlamentarCreateForm, ParlamentarForm)
from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa,
@ -22,15 +22,6 @@ from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa,
DependenteCrud = MasterDetailCrud.build(Dependente, 'parlamentar', '')
def permissoes_parlamentares():
lista_permissoes = []
cts = ContentType.objects.filter(app_label='parlamentares')
perms_parlamentares = list(Permission.objects.filter(content_type__in=cts))
for p in perms_parlamentares:
lista_permissoes.append('parlamentares.' + p.codename)
return set(lista_permissoes)
class CargoMesaCrud(Crud):
model = CargoMesa
help_path = 'cargo_mesa'

23
sapl/protocoloadm/views.py

@ -3,8 +3,6 @@ from datetime import date, datetime
from braces.views import FormValidMessageMixin
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.db.models import Max, Q
@ -18,7 +16,8 @@ from django_filters.views import FilterView
from sapl.crud.base import (Crud, CrudBaseMixin, CrudListView, make_pagination,
CrudCreateView, CrudUpdateView, CrudDeleteView)
from sapl.materia.models import Proposicao, TipoMateriaLegislativa
from sapl.utils import create_barcode, get_client_ip
from sapl.utils import (create_barcode, get_client_ip, permissoes_protocoloadm,
permissoes_adm)
from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm,
DocumentoAdministrativoFilterSet,
@ -42,24 +41,6 @@ ProtocoloMateriaCrud = Crud.build(Protocolo, '')
TipoInstituicaoCrud = Crud.build(TipoInstituicao, '')
def permissoes_protocoloadm():
lista_permissoes = []
cts = ContentType.objects.filter(app_label='protocoloadm')
perms_protocolo = list(Permission.objects.filter(content_type__in=cts))
for p in perms_protocolo:
lista_permissoes.append('protocoloadm.' + p.codename)
return set(lista_permissoes)
def permissoes_adm():
lista_permissoes = []
perms_adm = Permission.objects.filter(
group__name='Operador de Administração')
for p in perms_adm:
lista_permissoes.append('protocoloadm.' + p.codename)
return set(lista_permissoes)
class StatusTramitacaoAdministrativoCrud(Crud):
model = StatusTramitacaoAdministrativo
help_path = ''

162
sapl/sessao/views.py

@ -2,6 +2,7 @@ from datetime import datetime
from re import sub
from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.urlresolvers import reverse
from django.forms.utils import ErrorList
@ -14,14 +15,15 @@ from django_filters.views import FilterView
from rest_framework import generics
from sapl.crud.base import (Crud, CrudBaseMixin, CrudCreateView,
CrudDetailView, CrudListView, CrudUpdateView,
make_pagination)
CrudDeleteView, CrudDetailView, CrudListView,
CrudUpdateView, make_pagination)
from sapl.crud.masterdetail import MasterDetailCrud
from sapl.materia.models import (Autoria, DocumentoAcessorio,
TipoMateriaLegislativa, Tramitacao)
from sapl.norma.models import NormaJuridica
from sapl.parlamentares.models import Parlamentar
from sapl.sessao.serializers import SessaoPlenariaSerializer
from sapl.utils import permissoes_sessao, permissoes_painel
from .forms import (BancadaForm, ExpedienteForm, ExpedienteMateriaForm,
ListMateriaForm, MateriaOrdemDiaForm, MesaForm,
@ -34,13 +36,8 @@ from .models import (Bancada, CargoBancada, CargoMesa, ExpedienteMateria,
TipoExpediente, TipoResultadoVotacao, TipoSessaoPlenaria,
VotoParlamentar)
TipoSessaoCrud = Crud.build(TipoSessaoPlenaria, 'tipo_sessao_plenaria')
OrdemDiaCrud = Crud.build(OrdemDia, '')
TipoResultadoVotacaoCrud = Crud.build(
TipoResultadoVotacao, 'tipo_resultado_votacao')
TipoExpedienteCrud = Crud.build(TipoExpediente, 'tipo_expediente')
RegistroVotacaoCrud = Crud.build(RegistroVotacao, '')
CargoBancadaCrud = Crud.build(CargoBancada, '')
def reordernar_materias_expediente(request, pk):
@ -60,8 +57,9 @@ class BancadaCrud(Crud):
model = Bancada
help_path = ''
class BaseMixin(CrudBaseMixin):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
list_field_names = ['nome', 'legislatura']
permission_required = permissoes_sessao()
class ListView(CrudListView):
ordering = 'legislatura'
@ -73,6 +71,38 @@ class BancadaCrud(Crud):
form_class = BancadaForm
class TipoSessaoCrud(Crud):
model = TipoSessaoPlenaria
help_path = 'tipo_sessao_plenaria'
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_sessao()
class TipoResultadoVotacaoCrud(Crud):
model = TipoResultadoVotacao
help_path = 'tipo_resultado_votacao'
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_sessao()
class TipoExpedienteCrud(Crud):
model = TipoExpediente
help_path = 'tipo_expediente'
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_sessao()
class CargoBancadaCrud(Crud):
model = CargoBancada
help_path = ''
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_sessao()
def abrir_votacao_view(request, pk, spk):
existe_votacao_aberta = ExpedienteMateria.objects.filter(
sessao_plenaria_id=spk, votacao_aberta=True
@ -163,11 +193,13 @@ class ExpedienteMateriaCrud(MasterDetailCrud):
obj.resultado)
return [self._as_row(obj) for obj in object_list]
class CreateView(MasterDetailCrud.CreateView):
class CreateView(PermissionRequiredMixin, MasterDetailCrud.CreateView):
form_class = ExpedienteMateriaForm
permission_required = permissoes_sessao()
class UpdateView(MasterDetailCrud.UpdateView):
class UpdateView(PermissionRequiredMixin, MasterDetailCrud.UpdateView):
form_class = ExpedienteMateriaForm
permission_required = permissoes_sessao()
def get_initial(self):
self.initial['tipo_materia'] = self.object.materia.tipo.id
@ -175,6 +207,9 @@ class ExpedienteMateriaCrud(MasterDetailCrud):
self.initial['ano_materia'] = self.object.materia.ano
return self.initial
class DeleteView(PermissionRequiredMixin, MasterDetailCrud.DeleteView):
permission_required = permissoes_sessao()
class DetailView(MasterDetailCrud.DetailView):
@property
@ -190,14 +225,41 @@ class OradorCrud(MasterDetailCrud):
class ListView(MasterDetailCrud.ListView):
ordering = ['numero_ordem', 'parlamentar']
class CreateView(PermissionRequiredMixin, MasterDetailCrud.CreateView):
permission_required = permissoes_sessao()
class UpdateView(PermissionRequiredMixin, MasterDetailCrud.UpdateView):
permission_required = permissoes_sessao()
class DeleteView(PermissionRequiredMixin, MasterDetailCrud.DeleteView):
permission_required = permissoes_sessao()
class OradorExpedienteCrud(OradorCrud):
model = OradorExpediente
class CreateView(PermissionRequiredMixin, MasterDetailCrud.CreateView):
permission_required = permissoes_sessao()
class UpdateView(PermissionRequiredMixin, MasterDetailCrud.UpdateView):
permission_required = permissoes_sessao()
class DeleteView(PermissionRequiredMixin, MasterDetailCrud.DeleteView):
permission_required = permissoes_sessao()
class OradorCrud(OradorCrud):
model = Orador
class CreateView(PermissionRequiredMixin, MasterDetailCrud.CreateView):
permission_required = permissoes_sessao()
class UpdateView(PermissionRequiredMixin, MasterDetailCrud.UpdateView):
permission_required = permissoes_sessao()
class DeleteView(PermissionRequiredMixin, MasterDetailCrud.DeleteView):
permission_required = permissoes_sessao()
class SessaoCrud(Crud):
model = SessaoPlenaria
@ -216,6 +278,15 @@ class SessaoCrud(Crud):
class ListView(CrudListView):
ordering = ['-data_inicio']
class CreateView(PermissionRequiredMixin, CrudCreateView):
permission_required = permissoes_sessao()
class UpdateView(PermissionRequiredMixin, CrudUpdateView):
permission_required = permissoes_sessao()
class DeleteView(PermissionRequiredMixin, CrudDeleteView):
permission_required = permissoes_sessao()
class PresencaMixin:
@ -234,10 +305,14 @@ class PresencaMixin:
yield (parlamentar, False)
class PresencaView(FormMixin, PresencaMixin, SessaoCrud.DetailView):
class PresencaView(PermissionRequiredMixin,
FormMixin,
PresencaMixin,
SessaoCrud.DetailView):
template_name = 'sessao/presenca.html'
form_class = PresencaForm
model = SessaoPlenaria
permission_required = permissoes_sessao()
def post(self, request, *args, **kwargs):
self.object = self.get_object()
@ -275,15 +350,18 @@ class PresencaView(FormMixin, PresencaMixin, SessaoCrud.DetailView):
return reverse('sapl.sessao:presenca', kwargs={'pk': pk})
class PainelView(TemplateView):
class PainelView(PermissionRequiredMixin, TemplateView):
template_name = 'sessao/painel.html'
permission_required = permissoes_painel()
class PresencaOrdemDiaView(FormMixin,
class PresencaOrdemDiaView(PermissionRequiredMixin,
FormMixin,
PresencaMixin,
SessaoCrud.CrudDetailView):
template_name = 'sessao/presenca_ordemdia.html'
form_class = PresencaForm
permission_required = permissoes_sessao()
def post(self, request, *args, **kwargs):
@ -427,9 +505,12 @@ class ListMateriaOrdemDiaView(FormMixin, SessaoCrud.CrudDetailView):
return self.get(self, request, args, kwargs)
class MateriaOrdemDiaView(FormMixin, SessaoCrud.CrudDetailView):
class MateriaOrdemDiaView(PermissionRequiredMixin,
FormMixin,
SessaoCrud.CrudDetailView):
template_name = 'sessao/materia_ordemdia.html'
form_class = MateriaOrdemDiaForm
permission_required = permissoes_sessao()
def get(self, request, *args, **kwargs):
self.object = self.get_object()
@ -491,9 +572,12 @@ class MateriaOrdemDiaView(FormMixin, SessaoCrud.CrudDetailView):
kwargs={'pk': pk})
class EditMateriaOrdemDiaView(FormMixin, SessaoCrud.CrudDetailView):
class EditMateriaOrdemDiaView(PermissionRequiredMixin,
FormMixin,
SessaoCrud.CrudDetailView):
template_name = 'sessao/materia_ordemdia_edit.html'
form_class = MateriaOrdemDiaForm
permission_required = permissoes_sessao()
def get(self, request, *args, **kwargs):
self.object = self.get_object()
@ -602,9 +686,10 @@ class EditMateriaOrdemDiaView(FormMixin, SessaoCrud.CrudDetailView):
kwargs={'pk': pk})
class MesaView(FormMixin, SessaoCrud.CrudDetailView):
class MesaView(PermissionRequiredMixin, FormMixin, SessaoCrud.CrudDetailView):
template_name = 'sessao/mesa.html'
form_class = MesaForm
permission_required = permissoes_sessao()
def get(self, request, *args, **kwargs):
self.object = self.get_object()
@ -872,9 +957,12 @@ class ResumoView(SessaoCrud.CrudDetailView):
return self.render_to_response(context)
class ExpedienteView(FormMixin, SessaoCrud.CrudDetailView):
class ExpedienteView(PermissionRequiredMixin,
FormMixin,
SessaoCrud.CrudDetailView):
template_name = 'sessao/expediente.html'
form_class = ExpedienteForm
permission_required = permissoes_sessao()
def post(self, request, *args, **kwargs):
self.object = self.get_object()
@ -936,13 +1024,16 @@ class ExpedienteView(FormMixin, SessaoCrud.CrudDetailView):
return reverse('sapl.sessao:expediente', kwargs={'pk': pk})
class VotacaoEditView(FormMixin, SessaoCrud.CrudDetailView):
class VotacaoEditView(PermissionRequiredMixin,
FormMixin,
SessaoCrud.CrudDetailView):
'''
Votação Simbólica e Secreta
'''
template_name = 'sessao/votacao/votacao_edit.html'
permission_required = permissoes_sessao()
def post(self, request, *args, **kwargs):
@ -1009,7 +1100,9 @@ class VotacaoEditView(FormMixin, SessaoCrud.CrudDetailView):
kwargs={'pk': pk})
class VotacaoView(FormMixin, SessaoCrud.CrudDetailView):
class VotacaoView(PermissionRequiredMixin,
FormMixin,
SessaoCrud.CrudDetailView):
'''
Votação Simbólica e Secreta
@ -1017,6 +1110,7 @@ class VotacaoView(FormMixin, SessaoCrud.CrudDetailView):
template_name = 'sessao/votacao/votacao.html'
form_class = VotacaoForm
permission_required = permissoes_sessao()
def get(self, request, *args, **kwargs):
self.object = self.get_object()
@ -1128,8 +1222,11 @@ class VotacaoView(FormMixin, SessaoCrud.CrudDetailView):
kwargs={'pk': pk})
class VotacaoNominalView(FormMixin, SessaoCrud.CrudDetailView):
class VotacaoNominalView(PermissionRequiredMixin,
FormMixin,
SessaoCrud.CrudDetailView):
template_name = 'sessao/votacao/nominal.html'
permission_required = permissoes_sessao()
def get(self, request, *args, **kwargs):
self.object = self.get_object()
@ -1255,8 +1352,11 @@ class VotacaoNominalView(FormMixin, SessaoCrud.CrudDetailView):
kwargs={'pk': pk})
class VotacaoNominalEditView(FormMixin, SessaoCrud.CrudDetailView):
class VotacaoNominalEditView(PermissionRequiredMixin,
FormMixin,
SessaoCrud.CrudDetailView):
template_name = 'sessao/votacao/nominal_edit.html'
permission_required = permissoes_sessao()
def get(self, request, *args, **kwargs):
self.object = self.get_object()
@ -1332,8 +1432,11 @@ class VotacaoNominalEditView(FormMixin, SessaoCrud.CrudDetailView):
kwargs={'pk': pk})
class VotacaoNominalExpedienteView(FormMixin, SessaoCrud.CrudDetailView):
class VotacaoNominalExpedienteView(PermissionRequiredMixin,
FormMixin,
SessaoCrud.CrudDetailView):
template_name = 'sessao/votacao/nominal.html'
permission_required = permissoes_sessao()
def get(self, request, *args, **kwargs):
self.object = self.get_object()
@ -1457,8 +1560,11 @@ class VotacaoNominalExpedienteView(FormMixin, SessaoCrud.CrudDetailView):
kwargs={'pk': pk})
class VotacaoNominalExpedienteEditView(FormMixin, SessaoCrud.CrudDetailView):
class VotacaoNominalExpedienteEditView(PermissionRequiredMixin,
FormMixin,
SessaoCrud.CrudDetailView):
template_name = 'sessao/votacao/nominal_edit.html'
permission_required = permissoes_sessao()
def get(self, request, *args, **kwargs):
self.object = self.get_object()
@ -1534,7 +1640,9 @@ class VotacaoNominalExpedienteEditView(FormMixin, SessaoCrud.CrudDetailView):
kwargs={'pk': pk})
class VotacaoExpedienteView(FormMixin, SessaoCrud.CrudDetailView):
class VotacaoExpedienteView(PermissionRequiredMixin,
FormMixin,
SessaoCrud.CrudDetailView):
'''
Votação Simbólica e Secreta
@ -1542,6 +1650,7 @@ class VotacaoExpedienteView(FormMixin, SessaoCrud.CrudDetailView):
template_name = 'sessao/votacao/votacao.html'
form_class = VotacaoForm
permission_required = permissoes_sessao()
def get(self, request, *args, **kwargs):
self.object = self.get_object()
@ -1655,7 +1764,9 @@ class VotacaoExpedienteView(FormMixin, SessaoCrud.CrudDetailView):
kwargs={'pk': pk})
class VotacaoExpedienteEditView(FormMixin, SessaoCrud.CrudDetailView):
class VotacaoExpedienteEditView(PermissionRequiredMixin,
FormMixin,
SessaoCrud.CrudDetailView):
'''
Votação Simbólica e Secreta
@ -1663,6 +1774,7 @@ class VotacaoExpedienteEditView(FormMixin, SessaoCrud.CrudDetailView):
template_name = 'sessao/votacao/votacao_edit.html'
form_class = VotacaoEditForm
permission_required = permissoes_sessao()
def get_success_url(self):
pk = self.kwargs['pk']

75
sapl/utils.py

@ -5,6 +5,9 @@ import magic
from django.apps import apps
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.core.checks import Warning, register
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from floppyforms import ClearableFileInput
@ -218,3 +221,75 @@ def intervalos_tem_intersecao(a_inicio, a_fim, b_inicio, b_fim):
maior_inicio = max(a_inicio, b_inicio)
menor_fim = min(a_fim, b_fim)
return maior_inicio <= menor_fim
def permissoes_materia():
lista_permissoes = []
cts = ContentType.objects.filter(app_label='materia')
perms_materia = list(Permission.objects.filter(content_type__in=cts))
for p in perms_materia:
lista_permissoes.append('materia.' + p.codename)
return set(lista_permissoes)
def permissoes_comissoes():
lista_permissoes = []
cts = ContentType.objects.filter(app_label='comissoes')
perms_comissoes = list(Permission.objects.filter(content_type__in=cts))
for p in perms_comissoes:
lista_permissoes.append('comissoes.' + p.codename)
return set(lista_permissoes)
def permissoes_norma():
lista_permissoes = []
cts = ContentType.objects.filter(app_label='norma')
perms_norma = list(Permission.objects.filter(content_type__in=cts))
for p in perms_norma:
lista_permissoes.append('norma.' + p.codename)
return set(lista_permissoes)
def permissoes_parlamentares():
lista_permissoes = []
cts = ContentType.objects.filter(app_label='parlamentares')
perms_parlamentares = list(Permission.objects.filter(content_type__in=cts))
for p in perms_parlamentares:
lista_permissoes.append('parlamentares.' + p.codename)
return set(lista_permissoes)
def permissoes_protocoloadm():
lista_permissoes = []
cts = ContentType.objects.filter(app_label='protocoloadm')
perms_protocolo = list(Permission.objects.filter(content_type__in=cts))
for p in perms_protocolo:
lista_permissoes.append('protocoloadm.' + p.codename)
return set(lista_permissoes)
def permissoes_adm():
lista_permissoes = []
perms_adm = Permission.objects.filter(
group__name='Operador de Administração')
for p in perms_adm:
lista_permissoes.append('protocoloadm.' + p.codename)
return set(lista_permissoes)
def permissoes_sessao():
lista_permissoes = []
perms_sessao = list(Permission.objects.filter(
group__name='Operador de Sessão'))
for p in perms_sessao:
lista_permissoes.append('sessao.' + p.codename)
return set(lista_permissoes)
def permissoes_painel():
lista_permissoes = []
perms_painel = list(Permission.objects.filter(
group__name='Operador de Painel'))
for p in perms_painel:
lista_permissoes.append('painel.' + p.codename)
return set(lista_permissoes)

Loading…
Cancel
Save