private function RestrictIpService::allowAccessByPermission in Restrict IP 8
Same name and namespace in other branches
- 8.2 src/Service/RestrictIpService.php \Drupal\restrict_ip\Service\RestrictIpService::allowAccessByPermission()
- 3.x src/Service/RestrictIpService.php \Drupal\restrict_ip\Service\RestrictIpService::allowAccessByPermission()
* Test to see if access should be granted based on
1 call to RestrictIpService::allowAccessByPermission()
- RestrictIpService::userIsBlocked in src/
Service/ RestrictIpService.php - *
File
- src/
Service/ RestrictIpService.php, line 245
Class
Namespace
Drupal\restrict_ip\ServiceCode
private function allowAccessByPermission() {
static $allow_access;
if (is_null($allow_access)) {
$allow_access = [];
}
if (!isset($allow_access[$this->currentPath])) {
$allow_access[$this->currentPath] = FALSE;
if ($this->config
->get('allow_role_bypass')) {
$current_path = $this->currentPath;
if ($this->currentUser
->hasPermission('bypass ip restriction') || in_array($current_path, array(
'/user',
'/user/login',
'/user/password',
'/user/logout',
'/user/register',
)) || strpos($current_path, '/user/reset/') === 0) {
$allow_access[$this->currentPath] = TRUE;
}
}
}
return $allow_access[$this->currentPath];
}