Jifty::Plugin::Quota::Model::Quota.3pm

Langue: en

Autres versions - même langue

Version: 2009-02-12 (ubuntu - 08/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Jifty::Plugin::Quota::Model::Quota - Quota model

DESCRIPTION

Generic quotas for Jifty model objects.

create PARAMHASH

create_from_object OBJECT [PARAMHASH]

Conveniently creates a quota record using a model OBJECT and an optional extra paramhash.

load_by_object OBJECT [PARAMHASH]

Conveniently loads a quota record using a model OBJECT and an optional extra paramhash.

object

Returns the object regulated by this quota.

usage_ok INTEGER

Checks if adding INTEGER to the current usage will exceed cap.

Returns true or false.

add_usage INTEGER

Adds INTEGER to usage if there is enough quota left.

Returns true on success, false on failure.

subtract_usage INTEGER

Subtracts INTEGER from usage.

current_user_can

If current user can read the referenced object, then they can read the quotas. No one can created, update, or delete quotas unless they are a superuser.