Fix a problem with IsSystemAdminOrAuditor for anonymous users

It was raising an error, but should really show the message about not
being authenticated.
This commit is contained in:
Jeff Bradberry
2022-01-13 14:44:50 -05:00
parent 6a131f70f0
commit dea5fd1a9d

View File

@@ -243,7 +243,7 @@ class IsSystemAdminOrAuditor(permissions.BasePermission):
""" """
def has_permission(self, request, view): def has_permission(self, request, view):
if not request.user: if not (request.user and request.user.is_authenticated):
return False return False
if request.method == 'GET': if request.method == 'GET':
return request.user.is_superuser or request.user.is_system_auditor return request.user.is_superuser or request.user.is_system_auditor