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):