Merge pull request #3091 from makeplane/chore/project-member-leave

chore: guest and viewer can leave project
This commit is contained in:
sriram veeraghanta 2023-12-12 17:35:14 +05:30 committed by GitHub
commit 09b4f6dedd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -42,6 +42,7 @@ from plane.app.permissions import (
WorkspaceUserPermission, WorkspaceUserPermission,
ProjectBasePermission, ProjectBasePermission,
ProjectMemberPermission, ProjectMemberPermission,
ProjectLitePermission,
) )
from plane.db.models import ( from plane.db.models import (
@ -602,6 +603,18 @@ class ProjectMemberViewSet(BaseViewSet):
ProjectMemberPermission, 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 = [ search_fields = [
"member__display_name", "member__display_name",
"member__first_name", "member__first_name",

View File

@ -168,7 +168,7 @@ export const ProjectMemberListItem: React.FC<Props> = observer((props) => {
); );
})} })}
</CustomSelect> </CustomSelect>
{isAdmin && ( {(isAdmin || memberDetails.id === currentProjectMemberInfo?.member.id) && (
<Tooltip <Tooltip
tooltipContent={ tooltipContent={
memberDetails.id === currentProjectMemberInfo?.member.id ? "Leave project" : "Remove member" memberDetails.id === currentProjectMemberInfo?.member.id ? "Leave project" : "Remove member"