Skip to content

Commit

Permalink
11
Browse files Browse the repository at this point in the history
  • Loading branch information
fabilya committed Oct 1, 2023
1 parent 7739a00 commit 323c688
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions backend/api/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
class OwnerUserOrReadOnly(permissions.BasePermission):

def has_object_permission(self, request, view, obj):
return (
request.method in SAFE_METHODS
or request.user.is_authenticated
and request.user.is_active
and request.user == obj.author
or request.user.is_staff
)
if request.method in SAFE_METHODS:
return True

return obj.user == request.user

0 comments on commit 323c688

Please sign in to comment.