public function IPRangesEventSubscriber::onKernelRequest in IP Ranges 8
File
- lib/
Drupal/ ip_ranges/ EventSubscriber/ IPRangesEventSubscriber.php, line 23
Class
Namespace
Drupal\ip_ranges\EventSubscriberCode
public function onKernelRequest(GetResponseEvent $event) {
if ($this->manager
->ipIsBanned($this->request
->getClientIp())) {
$event
->stopPropagation();
$response = new Response(t('Sorry, @ip has been banned.', array(
'@ip' => $this->request
->getClientIp(),
)), 403);
$event
->setResponse($response);
}
}