You are here

private function RestrictIpService::allowAccessBlacklistCountry in Restrict IP 8.2

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

* Test to see if the current user is blacklist based on their country

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

File

src/Service/RestrictIpService.php, line 422

Class

RestrictIpService

Namespace

Drupal\restrict_ip\Service

Code

private function allowAccessBlacklistCountry() {
  $allow_access = FALSE;
  if ($this->config
    ->get('country_white_black_list') == 2) {
    $country_code = $this
      ->ip2CountryGetCurrentUserCountry();
    if ($country_code) {
      $countries = explode(':', $this->config
        ->get('country_list'));
      return !in_array(strtoupper($country_code), $countries);
    }
  }
  return FALSE;
}