class UnBanIp
Provides the 'Remove the ban on an IP address' action.
@todo Add access callback information from Drupal 7. @todo We should maybe use a dedicated data type for the ip address, as we do in Drupal 7.
Plugin annotation
@RulesAction(
id = "rules_unban_ip",
label = @Translation("Remove the ban on an IP address"),
category = @Translation("Ban"),
provider = "ban",
context_definitions = {
"ip" = @ContextDefinition("string",
label = @Translation("IP Address"),
description = @Translation("Removes the ban on an IP address using the Ban Module. If no IP is provided, the current user IP is used."),
default_value = NULL,
required = FALSE
)
}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
- class \Drupal\rules\Core\RulesActionBase extends \Drupal\rules\Core\RulesActionInterface uses \Drupal\Core\Plugin\ContextAwarePluginTrait, \Drupal\rules\Context\ContextProviderTrait, \Drupal\rules\Core\ExecutablePluginTrait, \Drupal\rules\Core\ConfigurationAccessControlTrait implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\rules\Plugin\RulesAction\RulesBanActionBase extends \Drupal\Core\Plugin\ContainerFactoryPluginInterface implements \Drupal\rules\Core\RulesActionBase
- class \Drupal\rules\Plugin\RulesAction\UnBanIp implements \Drupal\rules\Plugin\RulesAction\RulesBanActionBase
- class \Drupal\rules\Plugin\RulesAction\RulesBanActionBase extends \Drupal\Core\Plugin\ContainerFactoryPluginInterface implements \Drupal\rules\Core\RulesActionBase
- class \Drupal\rules\Core\RulesActionBase extends \Drupal\rules\Core\RulesActionInterface uses \Drupal\Core\Plugin\ContextAwarePluginTrait, \Drupal\rules\Context\ContextProviderTrait, \Drupal\rules\Core\ExecutablePluginTrait, \Drupal\rules\Core\ConfigurationAccessControlTrait implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of UnBanIp
File
-
src/
Plugin/ RulesAction/ UnBanIp.php, line 27
Namespace
Drupal\rules\Plugin\RulesActionView source
class UnBanIp extends RulesBanActionBase {
/**
* Executes the UnBanIP action with the given context.
*
* @param string $ip
* (optional) The IP address for which the ban should be removed.
*/
protected function doExecute($ip = NULL) {
if (!isset($ip)) {
$ip = $this->requestStack
->getCurrentRequest()
->getClientIp();
}
$this->banManager
->unbanIp($ip);
$this->logger
->notice('Removed ban on IP address %ip', [
'%ip' => $ip,
]);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
ConfigurationAccessControlTrait::checkConfigurationAccess | public | function | Checks configuration permission. | ||
ContextProviderTrait::$providedContext | protected | property | The data objects that are provided by this plugin. | ||
ContextProviderTrait::getProvidedContext | public | function | |||
ContextProviderTrait::getProvidedContextDefinition | public | function | |||
ContextProviderTrait::getProvidedContextDefinitions | public | function | |||
ContextProviderTrait::setProvidedValue | public | function | |||
ContextProviderTrait::upcastEntityId | public | function | Upcasts an entity id to a full entity object. | ||
ExecutablePluginTrait::getLabelValue | protected | function | Get the translated label from the plugin definition. | ||
ExecutablePluginTrait::summary | public | function | Get the translated summary from the label annotation. | 4 | |
RulesActionBase::$configuration | protected | property | The plugin configuration. | ||
RulesActionBase::access | public | function | Checks object access. | Overrides RulesActionInterface::access | |
RulesActionBase::assertMetadata | public | function | Asserts additional metadata for the selected data. | Overrides ContextAwarePluginInterface::assertMetadata | |
RulesActionBase::autoSaveContext | public | function | Returns a list of context names that should be auto-saved after execution. | Overrides RulesActionInterface::autoSaveContext | 14 |
RulesActionBase::calculateDependencies | public | function | @todo this documentation is not actually inherited from any interface. Do we need this empty implementation? |
||
RulesActionBase::defaultConfiguration | public | function | @todo this documentation is not actually inherited from any interface. Do we need this empty implementation? |
||
RulesActionBase::execute | public | function | 2 | ||
RulesActionBase::executeMultiple | public | function | @todo this documentation is not actually inherited from any interface. Do we need this empty implementation? |
||
RulesActionBase::getConfiguration | public | function | @todo this documentation is not actually inherited from any interface. | ||
RulesActionBase::getContextValue | public | function | |||
RulesActionBase::refineContextDefinitions | public | function | Refines used and provided context definitions based upon context values. | Overrides ContextAwarePluginInterface::refineContextDefinitions | 5 |
RulesActionBase::setConfiguration | public | function | @todo this documentation is not actually inherited from any interface. | ||
RulesBanActionBase::$banManager | protected | property | The ban manager. | ||
RulesBanActionBase::$logger | protected | property | The logger channel the action will write log messages to. | ||
RulesBanActionBase::$requestStack | protected | property | The corresponding request stack. | ||
RulesBanActionBase::create | public static | function | |||
RulesBanActionBase::__construct | public | function | Constructs the RulesBanActionBase object. | ||
UnBanIp::doExecute | protected | function | Executes the UnBanIP action with the given context. |