public function checkPermission($ip, $context)
    {
        if (!is_string($ip)) {
            throw new \TypeError('The ip parameter must be a string.');
        }
        if (!$ip) {
            throw new \InvalidArgumentException('The ip parameter cannot be empty.');
        }

        $currentRequest = $this->requestStack->getCurrentRequest();

        if (!$currentRequest) {
            return false;
        }

        return IpUtils::checkIp($currentRequest->getClientIp(), $ip);
    }