Commit eb4ab24d authored by Mikaël Salson's avatar Mikaël Salson Committed by Vidjil Team

VidjilAuth.py: Make load_permission quicker

Since we just use the ID in the request, just retrieve it.
This is about a 2-fold increase in time.
parent c8ac9173
......@@ -185,11 +185,11 @@ class VidjilAuth(Auth):
if key not in self.permissions:
self.permissions[key] = {}
query = db(self.vidjil_accessible_query(PermissionEnum.read.value, object_of_action)).select(self.db[object_of_action].ALL)
query = db(self.vidjil_accessible_query(PermissionEnum.read.value, object_of_action)).select(self.db[object_of_action].id)
for row in query:
self.permissions[key][row.id] = False
query = db(self.vidjil_accessible_query(action, object_of_action)).select(self.db[object_of_action].ALL)
query = db(self.vidjil_accessible_query(action, object_of_action)).select(self.db[object_of_action].id)
for row in query:
self.permissions[key][row.id] = True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment