Improve redaction and anonymous user handling

This commit is contained in:
2022-08-03 21:56:27 +01:00
parent 8b7fef59c5
commit fc86aae119
3 changed files with 20 additions and 20 deletions

View File

@@ -1,7 +1,6 @@
import json
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse, HttpResponseForbidden, JsonResponse
from django.shortcuts import render
from django.views import View
@@ -24,9 +23,8 @@ class Drilldown(View):
def get(self, request):
# if not request.user.has_plan(self.plan_name):
# return render(request, "denied.html")
is_anonymous = isinstance(request.user, AnonymousUser)
if is_anonymous:
sizes = ["5", "10", "15", "20"]
if request.user.is_anonymous:
sizes = settings.OPENSEARCH_MAIN_SIZES_ANON
else:
sizes = settings.OPENSEARCH_MAIN_SIZES
context = {