mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: visibility and lock
This commit is contained in:
parent
ffdd515cf8
commit
8ae1e3cff2
@ -69,6 +69,15 @@ urlpatterns = [
|
|||||||
),
|
),
|
||||||
name="workspace-duplicate-view",
|
name="workspace-duplicate-view",
|
||||||
),
|
),
|
||||||
|
path(
|
||||||
|
"workspaces/<str:slug>/projects/<uuid:project_id>/views/<uuid:pk>/lock/",
|
||||||
|
WorkspaceViewViewSet.as_view(
|
||||||
|
{
|
||||||
|
"post": "toggle_lock",
|
||||||
|
}
|
||||||
|
),
|
||||||
|
name="project-lock-views",
|
||||||
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/projects/<uuid:project_id>/views/",
|
"workspaces/<str:slug>/projects/<uuid:project_id>/views/",
|
||||||
ProjectViewViewSet.as_view(
|
ProjectViewViewSet.as_view(
|
||||||
@ -109,6 +118,15 @@ urlpatterns = [
|
|||||||
),
|
),
|
||||||
name="project-duplicate-view",
|
name="project-duplicate-view",
|
||||||
),
|
),
|
||||||
|
path(
|
||||||
|
"workspaces/<str:slug>/projects/<uuid:project_id>/views/<uuid:pk>/lock/",
|
||||||
|
ProjectViewViewSet.as_view(
|
||||||
|
{
|
||||||
|
"post": "toggle_lock",
|
||||||
|
}
|
||||||
|
),
|
||||||
|
name="project-lock-views",
|
||||||
|
),
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/projects/<uuid:project_id>/views/<uuid:view_id>/favorite/",
|
"workspaces/<str:slug>/projects/<uuid:project_id>/views/<uuid:view_id>/favorite/",
|
||||||
ProjectViewFavoriteViewSet.as_view(
|
ProjectViewFavoriteViewSet.as_view(
|
||||||
|
@ -194,6 +194,11 @@ class WorkspaceViewViewSet(BaseViewSet):
|
|||||||
.filter(pk=pk, workspace__slug=slug)
|
.filter(pk=pk, workspace__slug=slug)
|
||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
|
if view.owned_by != self.request.user:
|
||||||
|
return Response(
|
||||||
|
{"error": "You cannot update the view"},
|
||||||
|
status=status.HTTP_403_FORBIDDEN,
|
||||||
|
)
|
||||||
view.access = request.data.get("access", view.access)
|
view.access = request.data.get("access", view.access)
|
||||||
view.save(update_fields=["access"])
|
view.save(update_fields=["access"])
|
||||||
return Response(ViewSerializer(view).data, status=status.HTTP_200_OK)
|
return Response(ViewSerializer(view).data, status=status.HTTP_200_OK)
|
||||||
@ -357,6 +362,11 @@ class ProjectViewViewSet(BaseViewSet):
|
|||||||
.filter(pk=pk, project_id=project_id, workspace__slug=slug)
|
.filter(pk=pk, project_id=project_id, workspace__slug=slug)
|
||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
|
if view.owned_by != self.request.user:
|
||||||
|
return Response(
|
||||||
|
{"error": "You cannot update the view"},
|
||||||
|
status=status.HTTP_403_FORBIDDEN,
|
||||||
|
)
|
||||||
view.access = request.data.get("access", view.access)
|
view.access = request.data.get("access", view.access)
|
||||||
view.save(update_fields=["access"])
|
view.save(update_fields=["access"])
|
||||||
return Response(ViewSerializer(view).data, status=status.HTTP_200_OK)
|
return Response(ViewSerializer(view).data, status=status.HTTP_200_OK)
|
||||||
|
Loading…
Reference in New Issue
Block a user