You are here

public function RestfulRateLimitBase::generateIdentifier in RESTful 7

Generates an identifier for the event and the request.

Parameters

\stdClass $account: The account object for the user making the request.

Return value

string

1 method overrides RestfulRateLimitBase::generateIdentifier()
RestfulRateLimitGlobal::generateIdentifier in plugins/rate_limit/RestfulRateLimitGlobal.class.php
Generates an identifier for the event and the request.

File

plugins/rate_limit/RestfulRateLimitBase.php, line 121
Contains \RestfulRateLimitBase

Class

RestfulRateLimitBase
@file Contains \RestfulRateLimitBase

Code

public function generateIdentifier(\stdClass $account = NULL) {
  $identifier = $this->resource . '::';
  if ($this->name == 'global') {

    // Don't split the id by resource if the event is global.
    $identifier = '';
  }
  $identifier .= $this->name . '::';
  $identifier .= empty($account->uid) ? ip_address() : $account->uid;
  return $identifier;
}