You are here

public function LegacyBackend::isAllowed in Service Container 7.2

Same name and namespace in other branches
  1. 7 src/Flood/LegacyBackend.php \Drupal\service_container\Flood\LegacyBackend::isAllowed()

Implements Drupal\Core\Flood\FloodInterface::isAllowed().

Checks whether a user is allowed to proceed with the specified event.

Events can have thresholds saying that each user can only do that event a certain number of times in a time window. This function verifies that the current user has not exceeded this threshold.

Parameters

$name: The unique name of the event.

$threshold: The maximum number of times each user can do this event per time window.

$window: Number of seconds in the time window for this event (default is 3600 seconds, or 1 hour).

$identifier: Unique identifier of the current user. Defaults to their IP address.

Return value

bool TRUE if the user is allowed to proceed. FALSE if they have exceeded the threshold and should not be allowed to proceed.

Overrides FloodInterface::isAllowed

File

src/Flood/LegacyBackend.php, line 104
Definition of Drupal\service_container\Flood\LegacyBackend.

Class

LegacyBackend
Defines the database flood backend. This is the default Drupal backend. @codeCoverageIgnore

Namespace

Drupal\service_container\Flood

Code

public function isAllowed($name, $threshold, $window = 3600, $identifier = NULL) {
  return $this->drupal7
    ->flood_is_allowed($name, $threshold, $window, $identifier);
}