Make Drilldown public
This commit is contained in:
parent
fa2bfdecdd
commit
b323ea2ae2
|
@ -61,7 +61,7 @@ from core.views.ui.insights import (
|
|||
)
|
||||
|
||||
urlpatterns = [
|
||||
path("", Home.as_view(), name="home"),
|
||||
path("", Drilldown.as_view(), name="home"),
|
||||
path("callback", Callback.as_view(), name="callback"),
|
||||
path("billing/", Billing.as_view(), name="billing"),
|
||||
path("order/<str:plan_name>/", Order.as_view(), name="order"),
|
||||
|
|
|
@ -93,6 +93,10 @@ def filter_blacklisted(user, response):
|
|||
if blacklisted_item in str(content):
|
||||
# Remove the item
|
||||
if item in response["hits"]["hits"]:
|
||||
# Anonymous
|
||||
if not user:
|
||||
response["hits"]["hits"].remove(item)
|
||||
else:
|
||||
if not user.is_superuser:
|
||||
response["hits"]["hits"].remove(item)
|
||||
# Let the UI know something was redacted
|
||||
|
@ -136,9 +140,13 @@ def query_results(request, size=None):
|
|||
return False
|
||||
if "query" in request.POST:
|
||||
query = request.POST["query"]
|
||||
if hasattr(request, "user"):
|
||||
user = request.user
|
||||
else:
|
||||
user = None
|
||||
results = run_main_query(
|
||||
client,
|
||||
request.user,
|
||||
user,
|
||||
query,
|
||||
size=size,
|
||||
)
|
||||
|
|
|
@ -17,27 +17,27 @@ from core.lib.threshold import (
|
|||
)
|
||||
|
||||
|
||||
class Drilldown(LoginRequiredMixin, View):
|
||||
class Drilldown(View):
|
||||
template_name = "ui/drilldown/drilldown.html"
|
||||
plan_name = "drilldown"
|
||||
|
||||
def get(self, request):
|
||||
if not request.user.has_plan(self.plan_name):
|
||||
return render(request, "denied.html")
|
||||
#if not request.user.has_plan(self.plan_name):
|
||||
# return render(request, "denied.html")
|
||||
context = {
|
||||
"sizes": settings.OPENSEARCH_MAIN_SIZES,
|
||||
}
|
||||
return render(request, self.template_name, context)
|
||||
|
||||
|
||||
class DrilldownSearch(LoginRequiredMixin, View):
|
||||
class DrilldownSearch(View):
|
||||
# parser_classes = [JSONParser]
|
||||
template_name = "ui/drilldown/results.html"
|
||||
plan_name = "drilldown"
|
||||
|
||||
def post(self, request):
|
||||
if not request.user.has_plan(self.plan_name):
|
||||
return HttpResponseForbidden()
|
||||
#if not request.user.has_plan(self.plan_name):
|
||||
# return HttpResponseForbidden()
|
||||
|
||||
context = query_results(request)
|
||||
if not context:
|
||||
|
@ -59,14 +59,14 @@ class DrilldownSearch(LoginRequiredMixin, View):
|
|||
return HttpResponse("No results")
|
||||
|
||||
|
||||
class ThresholdInfoModal(LoginRequiredMixin, APIView):
|
||||
class ThresholdInfoModal(APIView):
|
||||
parser_classes = [FormParser]
|
||||
plan_name = "drilldown"
|
||||
template_name = "modals/drilldown.html"
|
||||
|
||||
def post(self, request):
|
||||
if not request.user.has_plan(self.plan_name):
|
||||
return JsonResponse({"success": False})
|
||||
#if not request.user.has_plan(self.plan_name):
|
||||
# return JsonResponse({"success": False})
|
||||
if "net" not in request.data:
|
||||
return JsonResponse({"success": False})
|
||||
if "nick" not in request.data:
|
||||
|
|
Loading…
Reference in New Issue