Skip to content
Snippets Groups Projects
Commit 5b259b27 authored by Julian Pustkuchen's avatar Julian Pustkuchen
Browse files

Issue #3271172 by Anybody, Chandreshgiri Gauswami, nibo, Grevil: Ban the...

Issue #3271172 by Anybody, Chandreshgiri Gauswami, nibo, Grevil: Ban the Anonymous user requests, except the logged in user
parent 5a1bf2d7
No related branches found
No related tags found
No related merge requests found
bypass perimeter defence rules:
title: 'Bypass Perimeter Defence ban rules'
description: 'Allow users to bypass the rules defined by Perimeter Defence module.'
restrict access: true
...@@ -40,6 +40,9 @@ class PerimeterSubscriber implements EventSubscriberInterface { ...@@ -40,6 +40,9 @@ class PerimeterSubscriber implements EventSubscriberInterface {
* On page not found events, ban the IP if the request is suspicious. * On page not found events, ban the IP if the request is suspicious.
*/ */
public function handleBannedUrls(Event $event) { public function handleBannedUrls(Event $event) {
if (\Drupal::currentUser()->hasPermission('bypass perimeter defence rules')) {
return;
}
$exception = $event->getException(); $exception = $event->getException();
if ($exception instanceof NotFoundHttpException) { if ($exception instanceof NotFoundHttpException) {
$request_path = $event->getRequest()->getPathInfo(); $request_path = $event->getRequest()->getPathInfo();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment