mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-23 22:49:50 +03:00
IsNotAuthenticated
Allows access only to unauthenticated users.
This commit is contained in:
parent
b7523f4b9f
commit
22714715f8
|
@ -127,6 +127,15 @@ class BasePermission(metaclass=BasePermissionMetaclass):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class IsNotAuthenticated(BasePermission):
|
||||||
|
"""
|
||||||
|
Allows access only to unauthenticated users.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def has_permission(self, request, view):
|
||||||
|
return str(request.user) == 'AnonymousUser'
|
||||||
|
|
||||||
|
|
||||||
class AllowAny(BasePermission):
|
class AllowAny(BasePermission):
|
||||||
"""
|
"""
|
||||||
Allow any access.
|
Allow any access.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user