From 90de11c08dc89aaab352f7d7a80bef3b51e6b4d5 Mon Sep 17 00:00:00 2001 From: NarayanBavisetti Date: Tue, 12 Dec 2023 16:22:33 +0530 Subject: [PATCH] chore: guest and viewer can leave project --- apiserver/plane/app/views/project.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apiserver/plane/app/views/project.py b/apiserver/plane/app/views/project.py index 2ed82e7e9..c67575db5 100644 --- a/apiserver/plane/app/views/project.py +++ b/apiserver/plane/app/views/project.py @@ -42,6 +42,7 @@ from plane.app.permissions import ( WorkspaceUserPermission, ProjectBasePermission, ProjectMemberPermission, + ProjectLitePermission, ) from plane.db.models import ( @@ -602,6 +603,18 @@ class ProjectMemberViewSet(BaseViewSet): ProjectMemberPermission, ] + def get_permissions(self): + if self.action == "leave": + self.permission_classes = [ + ProjectLitePermission, + ] + else: + self.permission_classes = [ + ProjectMemberPermission, + ] + + return super(ProjectMemberViewSet, self).get_permissions() + search_fields = [ "member__display_name", "member__first_name",