Skip to content

Commit

Permalink
chore: views (#2288)
Browse files Browse the repository at this point in the history
* chore: global views order by

* chore: update permissions for global views

---------

Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
  • Loading branch information
pablohashescobar and NarayanBavisetti committed Sep 28, 2023
1 parent 32d2f91 commit 6afbd3f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
11 changes: 10 additions & 1 deletion apiserver/plane/api/permissions/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,17 @@ def has_permission(self, request, view):
if request.user.is_anonymous:
return False

## Safe Methods -> Handle the filtering logic in queryset
if request.method in SAFE_METHODS:
return WorkspaceMember.objects.filter(
workspace__slug=view.workspace_slug,
member=request.user,
).exists()

return WorkspaceMember.objects.filter(
member=request.user, workspace__slug=view.workspace_slug
member=request.user,
workspace__slug=view.workspace_slug,
role__in=[Owner, Admin],
).exists()


Expand Down
2 changes: 0 additions & 2 deletions apiserver/plane/api/views/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from django.utils.decorators import method_decorator
from django.views.decorators.gzip import gzip_page
from django.db import IntegrityError
from django.conf import settings
from django.db import IntegrityError

# Third Party imports
Expand Down Expand Up @@ -58,7 +57,6 @@
IssuePublicSerializer,
)
from plane.api.permissions import (
WorkspaceEntityPermission,
ProjectEntityPermission,
WorkSpaceAdminPermission,
ProjectMemberPermission,
Expand Down
2 changes: 1 addition & 1 deletion apiserver/plane/api/views/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_queryset(self):
.get_queryset()
.filter(workspace__slug=self.kwargs.get("slug"))
.select_related("workspace")
.order_by("-created_at")
.order_by(self.request.GET.get("order_by", "-created_at"))
.distinct()
)

Expand Down

2 comments on commit 6afbd3f

@vercel
Copy link

@vercel vercel bot commented on 6afbd3f Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-sh-dev – ./space/

plane-space-dev.vercel.app
plane-sh-dev-git-develop-plane.vercel.app
plane-sh-dev-plane.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 6afbd3f Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-dev – ./web/

plane-dev-plane.vercel.app
plane-dev.vercel.app
plane-dev-git-develop-plane.vercel.app

Please sign in to comment.