From 061eb67dca06888efc3090a08c270f9ebfdab515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Wed, 6 Apr 2022 10:00:21 -0300 Subject: [PATCH] Impede anonimos de exportar dados do mapa --- sigi/apps/home/templates/home/mapfilter.html | 3 ++- sigi/apps/home/views.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sigi/apps/home/templates/home/mapfilter.html b/sigi/apps/home/templates/home/mapfilter.html index 2dcb659..d03f7d4 100644 --- a/sigi/apps/home/templates/home/mapfilter.html +++ b/sigi/apps/home/templates/home/mapfilter.html @@ -145,6 +145,7 @@ {% endfor %} + {% if not user.is_anonymous %}
  • {% trans "Exportação de dados" %}
    @@ -166,7 +167,7 @@
  • - + {% endif %} diff --git a/sigi/apps/home/views.py b/sigi/apps/home/views.py index dc2a878..67fd6f4 100644 --- a/sigi/apps/home/views.py +++ b/sigi/apps/home/views.py @@ -5,7 +5,7 @@ from itertools import cycle from django.contrib.admin.sites import site from django.contrib.auth.decorators import login_required from django.db.models import Q, Count -from django.http import HttpResponse, JsonResponse +from django.http import HttpResponse, HttpResponseForbidden, JsonResponse from django.shortcuts import render, get_object_or_404 from django.template.loader import render_to_string from django.utils.translation import gettext as _ @@ -42,6 +42,8 @@ def openmap(request): for s, n in UnidadeFederativa.REGIAO_CHOICES] return render(request, 'home/openmap.html', context) else: + if request.user.is_anonymous(): + return HttpResponseForbidden() tipos_orgao = request.GET.getlist('tipo_orgao', []) tipos_servico = request.GET.getlist('tipo_servico', []) tipos_convenio = request.GET.getlist('tipo_convenio', [])