You are here

private function RestrictIpService::allowAccessWhitelistedPath in Restrict IP 8

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

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

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

File

src/Service/RestrictIpService.php, line 274

Class

RestrictIpService

Namespace

Drupal\restrict_ip\Service

Code

private function allowAccessWhitelistedPath() {
  $allow_access = FALSE;
  if ($this->config
    ->get('white_black_list') == 1) {
    $whitelisted_pages = $this
      ->getWhitelistedPagePaths();
    $current_whitelist = FALSE;
    if (count($whitelisted_pages)) {
      foreach ($whitelisted_pages as $whitelisted_page) {
        if ($this->pathMatcher
          ->matchPath($this->currentPath, $whitelisted_page)) {
          $current_whitelist = TRUE;
        }
      }
    }
    if ($current_whitelist) {
      $allow_access = TRUE;
    }
  }
  return $allow_access;
}