testing with user permission

This commit is contained in:
vabene1111
2020-06-17 11:06:08 +02:00
parent bbaedfad33
commit 4ee5a4fd9f
4 changed files with 13 additions and 6 deletions

View File

@@ -93,6 +93,8 @@ class DRFOwnerPermissions(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
if not request.user.is_authenticated:
return False
#if request.user.is_superuser:
# return True
if owner := getattr(obj, 'created_by', None):
return owner == request.user
if owner := getattr(obj, 'user', None):