[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/system/engine/ -> PhabricatorSystemActionEngine.php (summary)

(no description)

File Size: 170 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 5 functions

  willTakeAction()
  loadBlockedActors()
  loadScores()
  recordAction()
  getWindow()

Functions
Functions that are not part of a class:

willTakeAction(array $actors,PhabricatorSystemAction $action,$score)   X-Ref
Prepare to take an action, throwing an exception if the user has exceeded
the rate limit.

The `$actors` are a list of strings. Normally this will be a list of
user PHIDs, but some systems use other identifiers (like email
addresses). Each actor's score threshold is tracked independently. If
any actor exceeds the rate limit for the action, this method throws.

The `$action` defines the actual thing being rate limited, and sets the
limit.

You can pass either a positive, zero, or negative `$score` to this method:

- If the score is positive, the user is given that many points toward
the rate limit after the limit is checked. Over time, this will cause
them to hit the rate limit and be prevented from taking further
actions.
- If the score is zero, the rate limit is checked but no score changes
are made. This allows you to check for a rate limit before beginning
a workflow, so the user doesn't fill in a form only to get rate limited
at the end.
- If the score is negative, the user is credited points, allowing them
to take more actions than the limit normally permits. By awarding
points for failed actions and credits for successful actions, a
system can be sensitive to failure without overly restricting
legitimate uses.

If any actor is exceeding their rate limit, this method throws a
@{class:PhabricatorSystemActionRateLimitException}.

param: list<string> List of actors.
param: PhabricatorSystemAction Action being taken.
param: float Score or credit, see above.
return: void

loadBlockedActors(array $actors,PhabricatorSystemAction $action,$score)   X-Ref
No description

loadScores(array $actors,PhabricatorSystemAction $action)   X-Ref
No description

recordAction(array $actors,PhabricatorSystemAction $action,$score)   X-Ref
No description

getWindow()   X-Ref
No description



Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1