Fix restricted source handling
This commit is contained in:
parent
f14110dcd9
commit
c597af5523
|
@ -347,7 +347,7 @@ def query_results(
|
|||
source = query_params["source"]
|
||||
|
||||
if source in settings.OPENSEARCH_SOURCES_RESTRICTED:
|
||||
if not request.user.has_perm("restricted_sources"):
|
||||
if not request.user.has_perm("core.restricted_sources"):
|
||||
message = "Access denied"
|
||||
message_class = "danger"
|
||||
return {"message": message, "class": message_class}
|
||||
|
@ -363,11 +363,11 @@ def query_results(
|
|||
sources = [source]
|
||||
else:
|
||||
sources = settings.OPENSEARCH_MAIN_SOURCES
|
||||
if request.user.has_perm("restricted_sources"):
|
||||
print("SOURCES", sources)
|
||||
if request.user.has_perm("core.restricted_sources"):
|
||||
print("HAS PERM")
|
||||
for source_iter in settings.OPENSEARCH_SOURCES_RESTRICTED:
|
||||
sources.append(source_iter)
|
||||
else:
|
||||
sources = settings.OPENSEARCH_MAIN_SOURCES
|
||||
|
||||
add_top_tmp = {"bool": {"should": []}}
|
||||
for source_iter in sources:
|
||||
|
|
Loading…
Reference in New Issue