code: def perform_authorization(self):
          
  
          for permission in self.permissions:
              if not permission.has_permission():
                  if request.user:
                      raise errors.PermissionDenied()
                  else:
                      raise errors.NotAuthenticated()
docs: Check if the request should be permitted.
          Raises an appropriate exception if the request is not permitted.