mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-23 14:40:06 +03:00
IsNotAuthenticated
Allows access only to unauthenticated users.
This commit is contained in:
parent
b7523f4b9f
commit
842c0dc6ef
|
@ -127,6 +127,15 @@ class BasePermission(metaclass=BasePermissionMetaclass):
|
|||
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):
|
||||
"""
|
||||
Allow any access.
|
||||
|
|
Loading…
Reference in New Issue
Block a user