feat(backend): manager override with one-time PIN approval for cancel, price change, over-limit discount
Platform v2 step 1.9 (APPS_PLATFORM D-10).
- Perm(..., overridable=True). check() answers access.override_possible (not
access.denied) for such keys, and consumes an X-Xenia-Override token for them.
- POST /api/access/override {key, username, pin}: the approver must hold the key
(module effective); returns a token valid 60 s, once, for that key and the
requesting session only (sha256 stored). Wrong PINs throttled per session.
GET /api/access/overrides: audit list (core.staff.manage).
- access_overrides table (revision 0008): who asked, session, who approved, device,
key, created/expires/used, target. The revision also grants core.devices.manage and
the new pricing.discounts.over_limit to existing owners/store managers.
- Overridable: ordering.orders.cancel (the three cancel endpoints; the order audit log
notes "override #n approved by user m"), ordering.prices.modify (price adjust), and
new pricing.discounts.over_limit (waiter discounts beyond their limits; the reason
goes in params). The venue switch discounts.enabled is never overridable.
- /orders/cancel-permissions adds override_possible; permission catalogues expose
`overridable`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,7 @@ MODULE = Module(
|
||||
Mount('routers.ws', '/api/ws'),
|
||||
Mount('routers.recovery', '/api/recovery'),
|
||||
Mount('routers.devices', '/api/devices'),
|
||||
Mount('routers.access', '/api/access'),
|
||||
Mount('core.modules.api', '/api/platform'),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -10,8 +10,8 @@ MODULE = Module(
|
||||
permissions=(
|
||||
Perm('ordering.orders.open', 'Open orders and add items', roles=('owner', 'store_manager', 'barista', 'barman', 'waiter')),
|
||||
Perm('ordering.orders.close', 'Take payments and close orders', roles=('owner', 'store_manager', 'barista', 'barman', 'waiter')),
|
||||
Perm('ordering.orders.cancel', 'Cancel items already sent', roles=('owner', 'store_manager')),
|
||||
Perm('ordering.prices.modify', "Change an item's price", roles=('owner',)),
|
||||
Perm('ordering.orders.cancel', 'Cancel items already sent', roles=('owner', 'store_manager'), overridable=True),
|
||||
Perm('ordering.prices.modify', "Change an item's price", roles=('owner',), overridable=True),
|
||||
Perm('ordering.business_day.manage', 'Open and close the business day', roles=('owner', 'store_manager', 'staff_manager')),
|
||||
),
|
||||
settings=(
|
||||
|
||||
@@ -10,6 +10,7 @@ MODULE = Module(
|
||||
permissions=(
|
||||
Perm('pricing.manage', 'Set up price groups, modifiers and deals', roles=('owner', 'store_manager')),
|
||||
Perm('pricing.discounts.apply', 'Give discounts', roles=('owner', 'store_manager')),
|
||||
Perm('pricing.discounts.over_limit', 'Give discounts beyond the per-waiter limits', roles=('owner', 'store_manager'), overridable=True),
|
||||
),
|
||||
settings=(
|
||||
SettingDef('discounts.enabled', 'true', 'Global switch for waiter discounts.', type='bool'),
|
||||
|
||||
Reference in New Issue
Block a user