mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
Added IsSuperUser permission
This commit is contained in:
parent
acbd9d8222
commit
7f2b8815b2
|
@ -137,6 +137,15 @@ class IsAuthenticated(BasePermission):
|
||||||
return bool(request.user and request.user.is_authenticated)
|
return bool(request.user and request.user.is_authenticated)
|
||||||
|
|
||||||
|
|
||||||
|
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 IsAdminUser(BasePermission):
|
class IsAdminUser(BasePermission):
|
||||||
"""
|
"""
|
||||||
Allows access only to admin users.
|
Allows access only to admin users.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user