Skip to content

Commit

Permalink
Merge pull request #233 from stanfordnmbl/dev
Browse files Browse the repository at this point in the history
[Under review] - Filter out dashboards not belonging to you
  • Loading branch information
AlbertoCasasOrtiz authored Oct 22, 2024
2 parents 6bc0aa2 + 4b0f732 commit 9337d2d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mcserver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2557,6 +2557,15 @@ def get_queryset(self):
users_have_public_sessions = User.objects.filter(session__public=True).distinct()
return AnalysisDashboard.objects.filter(user__in=users_have_public_sessions)

def list(self, request):
queryset = self.get_queryset()
if self.request.user.is_authenticated:
queryset = queryset.filter(user=self.request.user)
else:
queryset = queryset.none()
serializer = AnalysisDashboardSerializer(queryset, many=True)
return Response(serializer.data)

@action(detail=True)
def data(self, request, pk):
dashboard = get_object_or_404(AnalysisDashboard, pk=pk)
Expand Down

0 comments on commit 9337d2d

Please sign in to comment.