Skip to content

Commit

Permalink
Restrict semantic query API listing to user's own (#486 #163)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed Jul 29, 2021
1 parent b1b0ce8 commit 3756a53
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions backend/items/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,13 @@ class SemanticQueryViewSet(
):
queryset = SemanticQuery.objects.all()

def get_queryset(self):
if self.action == 'list':
if self.request.user.is_anonymous:
return self.queryset.none()
return self.queryset.filter(creator=self.request.user)
return self.queryset

def get_serializer_class(self):
if self.action == 'retrieve':
return SemanticQuerySerializerFull
Expand Down

0 comments on commit 3756a53

Please sign in to comment.