You are here

private function RouteSubscriber::denyAccess in No Request New Password 8

Deny access to the route if noreqnewpass_disable is set to TRUE.

Parameters

\Symfony\Component\Routing\Route $route: The route to deny access to.

1 call to RouteSubscriber::denyAccess()
RouteSubscriber::alterRoutes in src/Routing/RouteSubscriber.php
Alters existing routes for a specific collection.

File

src/Routing/RouteSubscriber.php, line 34

Class

RouteSubscriber
Listens to the dynamic route events.

Namespace

Drupal\noreqnewpass\Routing

Code

private function denyAccess(Route $route) : void {
  $noreqnewpass_disable = \Drupal::config('noreqnewpass.settings_form')
    ->get('noreqnewpass_disable');
  if ($noreqnewpass_disable) {
    $route
      ->setRequirement('_access', 'FALSE');
  }
}