Don't include the DJ for create/modify permissions.

This commit is contained in:
Josh Washburne 2018-04-03 16:23:48 -04:00
parent 1d6a2662c3
commit 5bcf6c72d9

View file

@ -18,7 +18,9 @@ class IsAdminOrReadOnly(permissions.BasePermission):
if request.method in permissions.SAFE_METHODS:
return True
else:
return request.user.is_authenticated and request.user.is_staff
return (request.user.is_authenticated and
request.user.is_staff and
not request.user.is_dj)
class IsAdminOwnerOrReadOnly(permissions.BasePermission):
@ -29,7 +31,9 @@ class IsAdminOwnerOrReadOnly(permissions.BasePermission):
return True
else:
if request.user.is_authenticated:
return request.user.is_staff or request.user == obj.user
return (request.user.is_staff or
request.user == obj.user and
not request.user.is_dj)
else:
return False