You are here

private function RestrictIpService::allowAccessBlacklistedPath in Restrict IP 8

Same name and namespace in other branches
  1. 8.2 src/Service/RestrictIpService.php \Drupal\restrict_ip\Service\RestrictIpService::allowAccessBlacklistedPath()
  2. 3.x src/Service/RestrictIpService.php \Drupal\restrict_ip\Service\RestrictIpService::allowAccessBlacklistedPath()

* Test if the current path is allowed based on blacklist settings

1 call to RestrictIpService::allowAccessBlacklistedPath()
RestrictIpService::testForBlock in src/Service/RestrictIpService.php
*

File

src/Service/RestrictIpService.php, line 305

Class

RestrictIpService

Namespace

Drupal\restrict_ip\Service

Code

private function allowAccessBlacklistedPath() {
  $allow_access = FALSE;
  if ($this->config
    ->get('white_black_list') == 2) {
    $blacklisted_pages = $this
      ->getBlacklistedPagePaths();
    $current_blacklist = FALSE;
    if (count($blacklisted_pages)) {
      foreach ($blacklisted_pages as $blacklisted_page) {
        if ($this->pathMatcher
          ->matchPath($this->currentPath, $blacklisted_page)) {
          $current_blacklist = TRUE;
        }
      }
    }
    if (!$current_blacklist) {
      $allow_access = TRUE;
    }
  }
  return $allow_access;
}