public function AutobanController::getBanManagerData in Automatic IP ban (Autoban) 8
Get IP Ban Manager data from provider name.
Parameters
string $provider: Ban provider ID.
Return value
array Ban manager object, ban_name, ban_type.
2 calls to AutobanController::getBanManagerData()
- AutobanController::banIpAction in src/
Controller/ AutobanController.php - Direct ban controller.
- AutobanController::getBanManagerDataRule in src/
Controller/ AutobanController.php - Get IP Ban Manager data from autoban rule.
File
- src/
Controller/ AutobanController.php, line 142
Class
- AutobanController
- Provides an Autoban functional.
Namespace
Drupal\autoban\ControllerCode
public function getBanManagerData($provider) {
// Retrieve Ban provider data for the current provider.
$banProvider = $this
->getBanProvidersList($provider);
if ($banProvider) {
// Get Ban Manager object from AutobanProviderInterface implementation.
$service = $banProvider['service'];
if ($service) {
$connection = Database::getConnection();
// Return Ban Provider's Ban IP Manager and Ban Type.
return [
'ban_manager' => $service
->getBanIpManager($connection),
'ban_name' => $service
->getName(),
'ban_type' => $service
->getBanType(),
];
}
}
return NULL;
}