You are here

class IpBanSubscriber in IP Ban 8

Hierarchy

  • class \Drupal\ip_ban\EventSubscriber\IpBanSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of IpBanSubscriber

1 file declares its use of IpBanSubscriber
ip_ban.module in ./ip_ban.module
Module can "ban" or set site to "read only" by country or IP address.
1 string reference to 'IpBanSubscriber'
ip_ban.services.yml in ./ip_ban.services.yml
ip_ban.services.yml
1 service uses IpBanSubscriber
ip_ban_event_subscriber in ./ip_ban.services.yml
Drupal\ip_ban\EventSubscriber\IpBanSubscriber

File

src/EventSubscriber/IpBanSubscriber.php, line 16
Contains \Drupal\ip_ban\EventSubscriber\IpBanSubscriber.

Namespace

Drupal\ip_ban\EventSubscriber
View source
class IpBanSubscriber implements EventSubscriberInterface {

  /**
   * The IP ban manager.
   *
   * @var \Drupal\ip_ban\IpBanSetBanInterface
   */
  protected $iPBanManager;

  /**
   * Constructs a BanMiddleware object.
   *
   * @param \Drupal\ban\IpBanSetBanInterface $manager
   *   The IP Ban manager.
   */
  public function __construct(IpBanSetBanInterface $manager) {
    $this->iPBanManager = $manager;
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[KernelEvents::REQUEST][] = array(
      'hookInit',
      255,
    );
    return $events;
  }

  /**
   * Sets the ban value and action for authenticated users.
   *
   * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
   *   The event to process.
   */
  public function hookInit(GetResponseEvent $event) {

    // \Drupal::service("router.builder")->rebuild();
    $this->iPBanManager
      ->iPBanSetValue();
    $this->iPBanManager
      ->iPBanDetermineAction();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
IpBanSubscriber::$iPBanManager protected property The IP ban manager.
IpBanSubscriber::getSubscribedEvents public static function
IpBanSubscriber::hookInit public function Sets the ban value and action for authenticated users.
IpBanSubscriber::__construct public function Constructs a BanMiddleware object.