Skip to content

Commit

Permalink
Prefetch all objects in get_accessible_object_ids
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Mar 20, 2024
1 parent 85970d2 commit 91f5fa0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/iam/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,11 @@ def get_accessible_object_ids(
folders_with_local_view = set()
permissions_per_object_id = defaultdict(set)
ref_permission = Permission.objects.get(codename="view_folder")
all_objects = object_type.objects.all()
all_objects = (
object_type.objects.select_related("folder")
if hasattr(object_type, "folder")
else object_type.objects.all()
)
folder_for_object = {x: Folder.get_folder(x) for x in all_objects}
perimeter = set()
perimeter.add(folder)
Expand Down

0 comments on commit 91f5fa0

Please sign in to comment.