Fix results delay and add nicer icons
This commit is contained in:
@@ -92,7 +92,7 @@ def randomise_list(user, data):
|
||||
"""
|
||||
Randomise data in a list of dictionaries.
|
||||
"""
|
||||
if user.has_perm("bypass_randomisation"):
|
||||
if user.has_perm("core.bypass_randomisation"):
|
||||
return
|
||||
if isinstance(data, list):
|
||||
for index, item in enumerate(data):
|
||||
@@ -117,8 +117,10 @@ def obfuscate_list(user, data):
|
||||
"""
|
||||
Obfuscate data in a list of dictionaries.
|
||||
"""
|
||||
if user.has_perm("bypass_obfuscation"):
|
||||
if user.has_perm("core.bypass_obfuscation"):
|
||||
print("USER HAS PERM")
|
||||
return
|
||||
print("NO HAVE PERM")
|
||||
for index, item in enumerate(data):
|
||||
for key, value in item.items():
|
||||
# Obfuscate a ratio of the field
|
||||
@@ -162,7 +164,7 @@ def hash_list(user, data, hash_keys=False):
|
||||
"""
|
||||
Hash a list of dicts or a list with SipHash42.
|
||||
"""
|
||||
if user.has_perm("bypass_hashing"):
|
||||
if user.has_perm("core.bypass_hashing"):
|
||||
return
|
||||
cache = "cache.hash"
|
||||
hash_table = {}
|
||||
@@ -214,7 +216,7 @@ def hash_lookup(user, data_dict):
|
||||
denied = []
|
||||
for key, value in list(data_dict.items()):
|
||||
if key in settings.SEARCH_FIELDS_DENY:
|
||||
if not user.has_perm("bypass_hashing"):
|
||||
if not user.has_perm("core.bypass_hashing"):
|
||||
data_dict[key] = SearchDenied(key=key, value=data_dict[key])
|
||||
denied.append(data_dict[key])
|
||||
if (
|
||||
@@ -236,7 +238,7 @@ def hash_lookup(user, data_dict):
|
||||
hashes.append(h)
|
||||
if not hashes:
|
||||
# Otherwise the user could inject plaintext search queries
|
||||
if not user.has_perm("bypass_hashing"):
|
||||
if not user.has_perm("core.bypass_hashing"):
|
||||
data_dict[key] = SearchDenied(key=key, value=data_dict[key])
|
||||
denied.append(data_dict[key])
|
||||
continue
|
||||
@@ -275,7 +277,7 @@ def hash_lookup(user, data_dict):
|
||||
|
||||
|
||||
def encrypt_list(user, data, secret):
|
||||
if user.has_perm("bypass_encryption"):
|
||||
if user.has_perm("core.bypass_encryption"):
|
||||
return
|
||||
cipher = Cipher(algorithms.AES(secret), ECB())
|
||||
for index, item in enumerate(data):
|
||||
|
||||
@@ -369,7 +369,7 @@ class DrilldownContextModal(APIView):
|
||||
return render(request, self.template_name, results)
|
||||
|
||||
if settings.HASHING: # we probably want to see the tokens
|
||||
if not request.user.has_perm("bypass_hashing"):
|
||||
if not request.user.has_perm("core.bypass_hashing"):
|
||||
for index, item in enumerate(results["object_list"]):
|
||||
if "tokens" in item:
|
||||
results["object_list"][index]["msg"] = results["object_list"][
|
||||
|
||||
Reference in New Issue
Block a user