[WEB-2778] chore: private project join restriction (#6082)
* chore: private project join restriction * chore: update project not found container layout * chore: restrict other users to join private project * chore: add check condition using enum --------- Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
This commit is contained in:
parent
b72d18079f
commit
6ef62820fa
3 changed files with 11 additions and 1 deletions
|
|
@ -176,6 +176,10 @@ class ProjectViewSet(BaseViewSet):
|
|||
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(
|
||||
|
|
|
|||
|
|
@ -136,6 +136,12 @@ class UserProjectInvitationsViewset(BaseViewSet):
|
|||
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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue