def perform_authorization(self):
        """
        Check if the request should be permitted.
        Raises an appropriate exception if the request is not permitted.
        """

        for permission in self.permissions:
            if not permission.has_permission():
                if request.user:
                    raise errors.PermissionDenied()
                else:
                    raise errors.NotAuthenticated()