Skip to content

Commit

Permalink
fix: comment permission
Browse files Browse the repository at this point in the history
  • Loading branch information
0seoYun committed Aug 9, 2023
1 parent 4c5059e commit d566c69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none"
}
4 changes: 3 additions & 1 deletion community/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ class CommentViewSet(mixins.DestroyModelMixin, viewsets.GenericViewSet):
queryset = Comment.objects.all()

def get_permissions(self):
if self.action == ["destroy"]:
if self.action == "destroy":
return [IsOwnerOrReadOnly()]
elif self.action == "reports":
return [IsAuthenticated()]
return []

@action(detail=True, methods=["post"], permission_classes=[IsAuthenticated])
Expand Down

0 comments on commit d566c69

Please sign in to comment.