Browse Source

Conserta outro bug em documento administrativo

pull/663/head
Eduardo Calil 8 years ago
parent
commit
903a025035
  1. 6
      sapl/base/templatetags/common_tags.py
  2. 55
      sapl/protocoloadm/views.py

6
sapl/base/templatetags/common_tags.py

@ -95,11 +95,7 @@ def get_doc_adm_template_perms(user):
if app_config.documentos_administrativos == 'O':
return True
if user.has_perms(permissoes_adm()):
return True
else:
return False
return user.has_perms(permissoes_adm())
@register.filter

55
sapl/protocoloadm/views.py

@ -68,24 +68,26 @@ class DocumentoAdministrativoCrud(Crud):
def has_permission(self):
app_config = AppConfig.objects.last()
if app_config.documentos_administrativos == 'O':
return True
else:
perms = self.get_permission_required()
return self.request.user.has_perms(perms)
if app_config:
if app_config.documentos_administrativos == 'O':
return True
perms = self.get_permission_required()
return self.request.user.has_perms(perms)
class DetailView(PermissionRequiredMixin, CrudDetailView):
permission_required = permissoes_adm()
def has_permission(self):
app_config = AppConfig.objects.last()
if app_config.documentos_administrativos == 'O':
return True
else:
perms = self.get_permission_required()
return self.request.user.has_perms(perms)
if app_config:
if app_config.documentos_administrativos == 'O':
return True
perms = self.get_permission_required()
return self.request.user.has_perms(perms)
class StatusTramitacaoAdministrativoCrud(Crud):
@ -400,12 +402,13 @@ class PesquisarDocumentoAdministrativoView(PermissionRequiredMixin,
def has_permission(self):
app_config = AppConfig.objects.last()
if app_config.documentos_administrativos == 'O':
return True
else:
perms = self.get_permission_required()
return self.request.user.has_perms(perms)
if app_config:
if app_config.documentos_administrativos == 'O':
return True
perms = self.get_permission_required()
return self.request.user.has_perms(perms)
def get_filterset_kwargs(self, filterset_class):
super(PesquisarDocumentoAdministrativoView,
@ -621,24 +624,26 @@ class TramitacaoAdmCrud(MasterDetailCrud):
def has_permission(self):
app_config = AppConfig.objects.last()
if app_config.documentos_administrativos == 'O':
return True
else:
perms = self.get_permission_required()
return self.request.user.has_perms(perms)
if app_config:
if app_config.documentos_administrativos == 'O':
return True
perms = self.get_permission_required()
return self.request.user.has_perms(perms)
class DetailView(PermissionRequiredMixin, MasterDetailCrud.DetailView):
permission_required = permissoes_adm()
def has_permission(self):
app_config = AppConfig.objects.last()
if app_config.documentos_administrativos == 'O':
return True
else:
perms = self.get_permission_required()
return self.request.user.has_perms(perms)
if app_config:
if app_config.documentos_administrativos == 'O':
return True
perms = self.get_permission_required()
return self.request.user.has_perms(perms)
def get_nome_autor(request):

Loading…
Cancel
Save