mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-30 18:09:59 +03:00
Update permissions.py
Allows access only to super users.
This commit is contained in:
parent
0dac98d215
commit
4a24e63af6
|
@ -145,6 +145,14 @@ class IsAdminUser(BasePermission):
|
||||||
def has_permission(self, request, view):
|
def has_permission(self, request, view):
|
||||||
return bool(request.user and request.user.is_staff)
|
return bool(request.user and request.user.is_staff)
|
||||||
|
|
||||||
|
class IsSuperUser(BasePermission):
|
||||||
|
"""
|
||||||
|
Allows access only to super users.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def has_permission(self, request, view):
|
||||||
|
return bool(request.user and request.user.is_superuser)
|
||||||
|
|
||||||
|
|
||||||
class IsAuthenticatedOrReadOnly(BasePermission):
|
class IsAuthenticatedOrReadOnly(BasePermission):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user