From 8f5cb4998f890861d472adb7fd2c6e91e761d49a Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Fri, 17 Jun 2016 10:26:57 -0300 Subject: [PATCH] Faz as permissoes de Casa Legislativa --- sapl/base/views.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sapl/base/views.py b/sapl/base/views.py index eef8f7f4b..cbea94455 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -1,3 +1,4 @@ +from django.contrib.auth.mixins import PermissionRequiredMixin from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect from django.views.generic.base import TemplateView @@ -17,13 +18,16 @@ class CasaLegislativaCrud(Crud): model = CasaLegislativa help_path = '' - class BaseMixin(CrudBaseMixin): + class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): + permission_required = {'base.add_casalegislativa'} list_field_names = ['codigo', 'nome', 'sigla'] - class CreateView(CrudCreateView): + class CreateView(PermissionRequiredMixin, CrudCreateView): + permission_required = {'base.add_casa_legislativa'} form_class = CasaLegislativaForm - class UpdateView(CrudUpdateView): + class UpdateView(PermissionRequiredMixin, CrudUpdateView): + permission_required = {'base.change_casalegislativa'} form_class = CasaLegislativaForm class DetailView(CrudDetailView): @@ -35,7 +39,7 @@ class CasaLegislativaCrud(Crud): kwargs={'pk': self.kwargs['pk']})) -class HelpView(TemplateView): +class HelpView(PermissionRequiredMixin, TemplateView): # XXX treat non existing template as a 404!!!! def get_template_names(self):