You are here

private function RestrictIpService::buildWhitelistedIpAddresses in Restrict IP 8

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

* Build an array of whitelisted IP addresses based on site settings

1 call to RestrictIpService::buildWhitelistedIpAddresses()
RestrictIpService::allowAccessWhitelistedIp in src/Service/RestrictIpService.php
* Test to see if the current user has a whitelisted IP address

File

src/Service/RestrictIpService.php, line 357

Class

RestrictIpService

Namespace

Drupal\restrict_ip\Service

Code

private function buildWhitelistedIpAddresses() {

  // Get the value saved to the system, and turn it into an array of IP addresses.
  $ip_addresses = $this
    ->getWhitelistedIpAddresses();

  // Add any whitelisted IPs from the settings.php file to the whitelisted array
  $ip_whitelist = $this->config
    ->get('ip_whitelist');
  if (count($ip_whitelist)) {
    $ip_addresses = array_merge($ip_addresses, $ip_whitelist);
  }
  return $ip_addresses;
}