From 0eda404732462167786d0ca05ac6ad670f70405d Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 27 Aug 2022 12:25:54 +0100 Subject: [PATCH] Improve denied output --- core/lib/opensearch.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/lib/opensearch.py b/core/lib/opensearch.py index d9fcd18..ccee8eb 100644 --- a/core/lib/opensearch.py +++ b/core/lib/opensearch.py @@ -320,16 +320,15 @@ def query_results( denied_t = hash_lookup(request.user, tags) denied.extend(denied_t) - message = [] + message = "Permission denied: " for x in denied: if isinstance(x, SearchDenied): - message.append(f"Permission denied to search by {x.key}: {x.value}") + message += f"Search({x.key}: {x.value}) " elif isinstance(x, LookupDenied): - message.append(f"Tag {x.key}: {x.value} not expected here. Nice try.") + message += f"Lookup({x.key}: {x.value}) " if denied: - print("DENIED DICT", message) - message = [f"{i}" for i in message] - message = "\n".join(message) + #message = [f"{i}" for i in message] + #message = "\n".join(message) message_class = "danger" return {"message": message, "class": message_class}