Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WEB-2778] chore: private project join restriction #6082

Merged
merged 5 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apiserver/plane/app/views/project/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ def list(self, request, slug):
def retrieve(self, request, slug, pk):
project = (
self.get_queryset()
.filter(
project_projectmember__member=self.request.user,
project_projectmember__is_active=True,
)
.filter(archived_at__isnull=True)
.filter(pk=pk)
.annotate(
Expand Down
6 changes: 6 additions & 0 deletions apiserver/plane/app/views/project/invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ def create(self, request, slug):
member=request.user, workspace__slug=slug, is_active=True
)

if workspace_member.role != ROLE.ADMIN:
return Response(
{"error": "You do not have permission to join the project"},
status=status.HTTP_403_FORBIDDEN,
)

workspace_role = workspace_member.role
workspace = workspace_member.workspace

Expand Down
2 changes: 1 addition & 1 deletion web/core/layouts/auth-layout/project-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export const ProjectAuthWrapper: FC<IProjectAuthWrapper> = observer((props) => {
// check if the project info is not found.
if (!loader && !projectExists && projectId && !!hasPermissionToCurrentProject === false)
return (
<div className="container grid h-screen place-items-center bg-custom-background-100">
<div className="grid h-screen place-items-center bg-custom-background-100">
rahulramesha marked this conversation as resolved.
Show resolved Hide resolved
<EmptyState
title="No such project exists"
description="Try creating a new project"
Expand Down
Loading