added first public views - no check for access rights at the moment
This commit is contained in:
11
lib/api/permissions.py
Normal file
11
lib/api/permissions.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from rest_framework import permissions
|
||||
|
||||
|
||||
class IsAuthorOrReadOnly(permissions.BasePermission):
|
||||
|
||||
def has_object_permission(self, request, view, obj):
|
||||
# Read permissions are allowed to any request
|
||||
if request.method in permissions.SAFE_METHODS:
|
||||
return True
|
||||
|
||||
return obj.author == request.user or request.user.is_superuser
|
||||
Reference in New Issue
Block a user