Browse Source

Impede anonimos de exportar dados do mapa

pull/159/head
Sesostris Vieira 3 years ago
parent
commit
061eb67dca
  1. 3
      sigi/apps/home/templates/home/mapfilter.html
  2. 4
      sigi/apps/home/views.py

3
sigi/apps/home/templates/home/mapfilter.html

@ -145,6 +145,7 @@
{% endfor %} {% endfor %}
</div> </div>
</li> </li>
{% if not user.is_anonymous %}
<li> <li>
<div class="collapsible-header">{% trans "Exportação de dados" %}</div> <div class="collapsible-header">{% trans "Exportação de dados" %}</div>
<div class="collapsible-body"> <div class="collapsible-body">
@ -166,7 +167,7 @@
</button> </button>
</div> </div>
</li> </li>
{% endif %}
</ul> </ul>

4
sigi/apps/home/views.py

@ -5,7 +5,7 @@ from itertools import cycle
from django.contrib.admin.sites import site from django.contrib.admin.sites import site
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.db.models import Q, Count 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.shortcuts import render, get_object_or_404
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
@ -42,6 +42,8 @@ def openmap(request):
for s, n in UnidadeFederativa.REGIAO_CHOICES] for s, n in UnidadeFederativa.REGIAO_CHOICES]
return render(request, 'home/openmap.html', context) return render(request, 'home/openmap.html', context)
else: else:
if request.user.is_anonymous():
return HttpResponseForbidden()
tipos_orgao = request.GET.getlist('tipo_orgao', []) tipos_orgao = request.GET.getlist('tipo_orgao', [])
tipos_servico = request.GET.getlist('tipo_servico', []) tipos_servico = request.GET.getlist('tipo_servico', [])
tipos_convenio = request.GET.getlist('tipo_convenio', []) tipos_convenio = request.GET.getlist('tipo_convenio', [])

Loading…
Cancel
Save