diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index dfe89ed2a..d1e84e088 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -110,7 +110,7 @@ class IsAuthenticated(BasePermission): """ def has_permission(self, request, view): - return request.user and request.user.is_authenticated + return bool(request.user and request.user.is_authenticated) class IsAdminUser(BasePermission): @@ -119,7 +119,7 @@ class IsAdminUser(BasePermission): """ def has_permission(self, request, view): - return request.user and request.user.is_staff + return bool(request.user and request.user.is_staff) class IsAuthenticatedOrReadOnly(BasePermission): @@ -128,7 +128,7 @@ class IsAuthenticatedOrReadOnly(BasePermission): """ def has_permission(self, request, view): - return ( + return bool( request.method in SAFE_METHODS or request.user and request.user.is_authenticated