From 90de11c08dc89aaab352f7d7a80bef3b51e6b4d5 Mon Sep 17 00:00:00 2001 From: NarayanBavisetti Date: Tue, 12 Dec 2023 16:22:33 +0530 Subject: [PATCH 1/2] 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", From c7d50bb7ce892d579ca974cf29702a8dfd2a1e00 Mon Sep 17 00:00:00 2001 From: LAKHAN BAHETI Date: Tue, 12 Dec 2023 17:00:59 +0530 Subject: [PATCH 2/2] fix: member role project leave --- web/components/project/member-list-item.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/components/project/member-list-item.tsx b/web/components/project/member-list-item.tsx index 2d987fd53..aa70b4703 100644 --- a/web/components/project/member-list-item.tsx +++ b/web/components/project/member-list-item.tsx @@ -168,7 +168,7 @@ export const ProjectMemberListItem: React.FC = observer((props) => { ); })} - {isAdmin && ( + {(isAdmin || memberDetails.id === currentProjectMemberInfo?.member.id) && (