# ClientProxyView
* refactors login required from method decorator to mixin inheritance
This commit is contained in:
parent
f2baa054bf
commit
61ec9c8c9b
@ -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")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user