forked from github/plane
Merge pull request #3091 from makeplane/chore/project-member-leave
chore: guest and viewer can leave project
This commit is contained in:
commit
09b4f6dedd
@ -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",
|
||||||
|
@ -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"
|
||||||
|
Loading…
Reference in New Issue
Block a user