From 015de8a40f4c4b3e35535623c9a73ac35b58f9ed Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 14 Oct 2021 03:27:15 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20private=20projects=20not?= =?UTF-8?q?=20being=20returned=20for=20the=20group=20owner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/sophon/projects/views.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/sophon/projects/views.py b/backend/sophon/projects/views.py index fc3a9df..a77d110 100644 --- a/backend/sophon/projects/views.py +++ b/backend/sophon/projects/views.py @@ -4,7 +4,6 @@ from django.db.models import Q from sophon.core.models import ResearchGroup from sophon.core.views import SophonGroupViewSet - from . import models @@ -23,9 +22,10 @@ class ResearchProjectsByGroupViewSet(ResearchProjectViewSet): else: return models.ResearchProject.objects.filter( Q(group__slug=self.kwargs["group_slug"]) & ( - Q(visibility="PUBLIC") | - Q(visibility="INTERNAL") | - Q(visibility="PRIVATE", group__members__in=[self.request.user]) + Q(visibility="PUBLIC") | + Q(visibility="INTERNAL") | + Q(visibility="PRIVATE", group__members__in=[self.request.user]) | + Q(visibility="PRIVATE", group__owner=self.request.user) ) ) @@ -40,5 +40,6 @@ class ResearchProjectsBySlugViewSet(ResearchProjectViewSet): return models.ResearchProject.objects.filter( Q(visibility="PUBLIC") | Q(visibility="INTERNAL") | - Q(visibility="PRIVATE", group__members__in=[self.request.user]) + Q(visibility="PRIVATE", group__members__in=[self.request.user]) | + Q(visibility="PRIVATE", group__owner=self.request.user) )