IsNotAuthenticated

Allows access only to unauthenticated users.
This commit is contained in:
Amir 2023-03-07 19:49:42 +03:30 committed by GitHub
parent b7523f4b9f
commit 22714715f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.