From 61ec9c8c9b183523497fbd90c9c3546036c62c00 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Fri, 17 Oct 2025 14:42:44 +0200 Subject: [PATCH] # ClientProxyView * refactors login required from method decorator to mixin inheritance --- konova/views/map_proxy.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/konova/views/map_proxy.py b/konova/views/map_proxy.py index daadb3c2..e702ad28 100644 --- a/konova/views/map_proxy.py +++ b/konova/views/map_proxy.py @@ -10,9 +10,8 @@ from json import JSONDecodeError import requests import urllib3.util -from django.contrib.auth.decorators import login_required +from django.contrib.auth.mixins import LoginRequiredMixin from django.http import JsonResponse, HttpRequest, HttpResponse -from django.utils.decorators import method_decorator from django.utils.http import urlencode from django.views import View @@ -22,17 +21,13 @@ from konova.sub_settings.lanis_settings import MAP_PROXY_HOST_WHITELIST from konova.sub_settings.proxy_settings import PROXIES, GEOPORTAL_RLP_USER, GEOPORTAL_RLP_PASSWORD -class BaseClientProxyView(View): +class BaseClientProxyView(LoginRequiredMixin, View): """ Provides proxy functionality for NETGIS map client. """ class Meta: abstract = True - @method_decorator(login_required) - def dispatch(self, request, *args, **kwargs): - return super().dispatch(request, *args, **kwargs) - def _check_with_whitelist(self, url): parsed_url = urllib3.util.parse_url(url) parsed_url_host = parsed_url.host @@ -67,7 +62,6 @@ class BaseClientProxyView(View): class ClientProxyParcelSearch(BaseClientProxyView): - def get(self, request: HttpRequest): url = request.META.get("QUERY_STRING")