Resource quotas – data model and adjustment
Grant and movement rows of the central resource ledger, the effect of a manual adjustment on the grant, the movement types and the permission keys.
Overview
A client's quantity quotas come from the grant rows of the central resource ledger (dlbtresource). Every change is written as a movement; the grant row is a cache of the movements.
Data model
Table names carry the installation's own prefix in the database.
| Table | Role | Main fields |
|---|---|---|
resource_grant | grant | client, object (feature, product, service), unit, quantity_granted, quantity_used, source, validity, carry-over, status |
resource_movement | movement | type, signed quantity, source, state, note, actor |
resource_movement_allocation | split of a movement across grants | movement, grant, quantity |
Movement types include RECEIPT, SALE, SUBSCRIPTION_GRANT, USAGE_CONSUMPTION, ADJUSTMENT, EXPIRY, REVERSAL.
Manual adjustment
balance.adjust&grant_id=with POSTquantity,note; a zero quantity is an error.- The grant must be in the caller's scope (
getGrant($id, $allowed)). - An
ADJUSTMENTmovement viadlbtresource->movement()(sourcemanual, actor = the user). - The grant cache is updated: a positive quantity raises
quantity_granted, a negative one raisesquantity_used, at most up to the granted amount.
Permissions
- Both screens are classified
SYSTEM(install/commerce_v1.sql); they are not in the function catalogue file. resource/balance:list,adjust,debug;resource/movement:list,debug. The movement link shows only withresource/movement::list.- Content scope in the model query (
getAllowedCompanyIds); the company picker endpoints (balance.companies,movement.companies) use thelistpermission.