The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

BTDT::Model::Quota

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.