Skip to content

Commit

Permalink
Update views.py
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-intuitem committed Jun 5, 2024
1 parent 37a9d09 commit 59919c5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ def get_queryset(self):
if not self.model:
return None
if q := re.match("/api/[\w-]+/([0-9a-f-]+)", self.request.path):
""""get_queryset is called by Django even for an individual object"""
""""get_queryset is called by Django even for an individual object via get_object
https://stackoverflow.com/questions/74048193/why-does-a-retrieve-request-end-up-calling-get-queryset"""
id = UUID(q.group(1))
if RoleAssignment.is_object_readable(self.request.user, self.model, id):
return self.model.objects.filter(id=id)
object_ids_view = [id]
else:
# todo: exception to refuse access
object_ids_view = []
Expand Down

0 comments on commit 59919c5

Please sign in to comment.