public function AutobanController::canIpBan in Automatic IP ban (Autoban) 8
Check IP address for ban.
Parameters
string $ip: IP candidate for ban.
Return value
bool Can ban.
1 call to AutobanController::canIpBan()
- AutobanController::banIp in src/
Controller/ AutobanController.php - Ban address.
File
- src/
Controller/ AutobanController.php, line 356
Class
- AutobanController
- Provides an Autoban functional.
Namespace
Drupal\autoban\ControllerCode
public function canIpBan($ip) {
// You cannot ban your current IP address.
if ($ip == \Drupal::request()
->getClientIp()) {
return FALSE;
}
// The IP address must not be whitelisted.
if ($this
->whitelistIp($ip)) {
return FALSE;
}
return TRUE;
}