mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 17:39:48 +03:00
added IsSuperUser permission
This commit is contained in:
parent
0dac98d215
commit
e4947c855a
|
@ -146,6 +146,15 @@ class IsAdminUser(BasePermission):
|
||||||
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):
|
||||||
"""
|
"""
|
||||||
The request is authenticated as a user, or is a read-only request.
|
The request is authenticated as a user, or is a read-only request.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user