From 2332706ffc3bb3cebf4644a6ce98e374514037ff Mon Sep 17 00:00:00 2001 From: LeandroRoberto Date: Fri, 8 Dec 2017 13:04:29 -0200 Subject: [PATCH] =?UTF-8?q?HOT-FIX=20problema=20com=20permiss=C3=A3o=20em?= =?UTF-8?q?=20legisla=C3=A7=C3=A3o=20citada?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Foi apresentado na lista GITEC um problema com permissão na aba Legislação Citada de matérias legislativas. O código removido neste commit se tornou irrelevante depois que o mapa de regras foi criado (app rule) --- sapl/materia/views.py | 50 ------------------------------------------- sapl/rules/apps.py | 2 +- 2 files changed, 1 insertion(+), 51 deletions(-) diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 2b4ef8348..299532733 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -959,7 +959,6 @@ class TramitacaoCrud(MasterDetailCrud): ultima_tramitacao.unidade_tramitacao_destino)] return context - def form_valid(self, form): self.object = form.save() @@ -1197,55 +1196,6 @@ class LegislacaoCitadaCrud(MasterDetailCrud): return reverse('%s:%s' % (namespace, self.url_name(suffix)), args=args) - def has_permission(self): - perms = self.get_permission_required() - # Torna a view pública se não possuir conteudo - # no atributo permission_required - return self.request.user.has_module_perms('materia')\ - if len(perms) else True - - def permission(self, rad): - return '%s%s%s' % ('norma' if rad.endswith('_') else '', - rad, - self.model_name if rad.endswith('_') else '') - - @property - def detail_create_url(self): - obj = self.crud if hasattr(self, 'crud') else self - if self.request.user.has_module_perms('materia'): - parent_field = obj.parent_field.split('__')[0] - parent_object = getattr(self.object, parent_field) - - root_pk = parent_object.pk - - return self.resolve_url(ACTION_CREATE, args=(root_pk,)) - return '' - - @property - def list_url(self): - return self.resolve_url(ACTION_LIST, args=(self.kwargs['pk'],))\ - if self.request.user.has_module_perms('materia') else '' - - @property - def create_url(self): - return self.resolve_url(ACTION_CREATE, args=(self.kwargs['pk'],))\ - if self.request.user.has_module_perms('materia') else '' - - @property - def detail_url(self): - return self.resolve_url(ACTION_DETAIL, args=(self.object.id,))\ - if self.request.user.has_module_perms('materia') else '' - - @property - def update_url(self): - return self.resolve_url(ACTION_UPDATE, args=(self.kwargs['pk'],))\ - if self.request.user.has_module_perms('materia') else '' - - @property - def delete_url(self): - return self.resolve_url(ACTION_DELETE, args=(self.object.id,))\ - if self.request.user.has_module_perms('materia') else '' - class CreateView(MasterDetailCrud.CreateView): form_class = LegislacaoCitadaForm diff --git a/sapl/rules/apps.py b/sapl/rules/apps.py index 3b6e9d271..b16f45905 100644 --- a/sapl/rules/apps.py +++ b/sapl/rules/apps.py @@ -127,7 +127,7 @@ def create_proxy_permissions( def update_groups(app_config, verbosity=2, interactive=True, - using=DEFAULT_DB_ALIAS, cria_usuarios_padrao=False, + using=DEFAULT_DB_ALIAS, cria_usuarios_padrao=True, **kwargs): if app_config != AppConfig and not isinstance(app_config, AppConfig):