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>
51 lines
4.2 KiB
Python
51 lines
4.2 KiB
Python
"""Module manifest — see core/modules/model.py and APPS_PLATFORM §4."""
|
|
from core.modules.model import Module, Mount, Perm, SettingDef
|
|
|
|
MODULE = Module(
|
|
key='core',
|
|
kind='core',
|
|
name='Core',
|
|
description='Login, staff, settings, license, system and live updates. Always on.',
|
|
permissions=(
|
|
Perm('core.dashboard.access', 'Open the manager dashboard', roles=('owner', 'store_manager', 'staff_manager')),
|
|
Perm('core.staff.manage', 'Add and edit staff', roles=('owner', 'store_manager', 'staff_manager')),
|
|
Perm('core.settings.manage', 'Change venue settings', roles=('owner',)),
|
|
Perm('core.modules.manage', 'Turn apps, features and integrations on or off', roles=('owner',)),
|
|
Perm('core.devices.manage', 'Pair, rename, reassign and remove devices', roles=('owner', 'store_manager')),
|
|
Perm('core.system.admin', 'Support-only maintenance (superadmin)', roles=()),
|
|
),
|
|
settings=(
|
|
SettingDef('dev.spoof_printing', 'false', 'When enabled, all print jobs are silently dropped. Devices behave as if printing succeeded.', type='bool'),
|
|
SettingDef('security.auto_lock', 'false', "Lock screen after inactivity: 'true' | 'false'", type='bool'),
|
|
SettingDef('security.auto_lock_seconds', '300', 'Seconds of inactivity before locking (0 = disabled)', type='int'),
|
|
SettingDef('security.auto_logout', 'false', "Log out after inactivity: 'true' | 'false'", type='bool'),
|
|
SettingDef('security.auto_logout_seconds', '1800', 'Seconds of inactivity before logging out (0 = disabled)', type='int'),
|
|
SettingDef('security.autofill_username', 'true', "Auto-fill username when only one manager exists: 'true' | 'false'", type='bool'),
|
|
SettingDef('auth.manager_login_mode', 'password', "How managers log in on the dashboard: 'password' | 'pin' (never username-only, D-8)", type='enum', choices=('password', 'pin')),
|
|
SettingDef('auth.waiter_login_mode', 'pin', "How waiters log in: 'pin' | 'password' | 'tap' (tap = pick your name; only on paired devices)", type='enum', choices=('pin', 'password', 'tap')),
|
|
SettingDef('auth.default_login_mode', 'pin', "How staff log in on paired devices (KDS, counter POS) unless the device sets its own: 'pin' | 'password' | 'tap' | 'none'. Apps that can't use it fall back to their first mode.", type='enum', choices=('pin', 'password', 'tap', 'none')),
|
|
SettingDef('auth.waiter_require_username', 'false', 'Waiters must type their username instead of picking their name', type='bool'),
|
|
SettingDef('auth.single_session_manager', 'off', "One manager session per user: 'off' | 'refuse_new' | 'end_old'", type='enum', choices=('off', 'refuse_new', 'end_old')),
|
|
SettingDef('auth.single_session_waiter', 'off', "One waiter session per user (no double login): 'off' | 'refuse_new' | 'end_old'", type='enum', choices=('off', 'refuse_new', 'end_old')),
|
|
SettingDef('system.log_retention_days', '30', 'Days of daily backend log files to keep in data/logs (default 30). Applied at backend start.', type='int'),
|
|
SettingDef('venue.language', 'en', 'Default language (en | el) for staff without their own language, and for printed reports/receipts and tickets of zones without one.', type='str'),
|
|
SettingDef('venue.timezone', 'Europe/Athens', 'IANA time zone of the venue (e.g. Europe/Athens). All times are shown in it; DST is automatic. Applies immediately.', type='str'),
|
|
SettingDef('venue.name', '', 'Venue name shown on screens and tickets.', type='str'),
|
|
SettingDef('venue.type', '', 'Kind of venue (restaurant, cafe, bar...), chosen in the setup wizard.', type='str'),
|
|
SettingDef('venue.currency', 'EUR', 'ISO 4217 currency of all prices.', type='str'),
|
|
),
|
|
routers=(
|
|
Mount('routers.setup', '/api/setup'),
|
|
Mount('routers.auth', '/api/auth'),
|
|
Mount('routers.waiters', '/api/waiters'),
|
|
Mount('routers.system', '/api/system'),
|
|
Mount('routers.settings', '/api/settings'),
|
|
Mount('routers.sse', '/api/sse'),
|
|
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'),
|
|
),
|
|
)
|