Commit graph

67 commits

Author SHA1 Message Date
3052113d31 Shared kiosk sessions: app kiosk registry, kiosk login, verify support, admin password
apps gain kiosk_path/kiosk_caps (hvac registered first). One shared kiosk
password mints a long-lived hnf_kiosk_session carrying only each registered
app's kiosk caps; /verify answers for kiosk sessions; changing the password
bumps an epoch that invalidates signed-in tablets.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 11:15:46 +00:00
107eaa7e35 Register lights app (LXC 133) and capabilities
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 12:33:57 +00:00
97a0b50c92 Require at least one capability to see/access apps that define them
An app-level grant (user_app_perms/role_app_perms) alone used to be
enough to show an app's portal tile and pass AuthGate, even with zero
capabilities held. Most apps only gate specific routes/buttons with
capabilities, not their dashboard/shell, so a role with the app toggled
on but no caps granted (e.g. wages, utilities, hvac, plant,
tablet-checkin — none of which auto-grant Staff caps) still saw the
full app. Apps with no capabilities defined at all keep prior behaviour.
2026-09-25 09:22:47 +00:00
f756a600b1 Add reallocate cap description, update assign/admin/settings wording for tasks app
Reflects the new tasks-app permission tiers (use/assign/reallocate/admin) —
descriptions were still saying "phase 2" for features that now exist.
2026-09-17 08:06:34 +00:00
0574ceddb0 Seed tablet-checkin app + push/admin/settings capabilities
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-01 17:37:01 +00:00
dfa6718cb5 Fix Staff role cashup permission resets: seed once, not on empty-caps guess
Several 'grant Staff these default caps' seeds in initDb() re-ran on every
auth container restart, guarded by 'role currently has no caps for this
app' as a proxy for 'first deploy'. If an admin revoked all of Staff's
cashup capabilities in the portal, the next restart saw zero cashup caps
and silently re-granted all 7 non-settings caps back — looking like
permissions randomly resetting to full access.

Add a seed_flags table + seedOnce() helper so these default-cap grants
(cashup x2, hk-planner, kds, tasks) run exactly once ever, tracked by a
durable flag instead of re-derived from current state. Deliberate
permission changes now stick across restarts/redeploys.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-31 12:58:02 +00:00
bf5aa5bf24 Move weather from Hotel to Operations category
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-25 14:37:24 +00:00
5a004bd606 Seed weather app + settings capability
LXC 131, base_path '/weather/admin' (portal card opens the authed status
page directly; the app's bare root '/weather/' is the public, no-auth
reception display). Single 'settings' capability, not auto-granted to
Staff — grant via Admin -> Roles.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-25 12:23:02 +00:00
d48701fcd0 Give KDS its own theme colour instead of kitchen's teal
KDS was seeded with the same theme_color as kitchen (#0d9488) — the two
Kitchen-category portal tiles were indistinguishable. Changed to #ea580c
(orange). See kitchen-port-log.md E17.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-06 14:45:03 +00:00
6faf8af09c Move plant to Hotel category instead of Operations
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-28 22:25:13 +00:00
8db43ebe97 Seed plant app + capabilities
Registers the new plant-room monitoring app (LXC 123): view,
manage_assets, acknowledge_alerts, settings capabilities.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-28 22:04:56 +00:00
e612ce7c64 Move hvac and utilities into Hotel sidebar category
They're not day-to-day operational apps, so group them separately
from Operations.
2026-07-28 12:44:50 +00:00
f626ee1e69 Register hvac app — seed row + capabilities
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-26 20:19:37 +00:00
b7468e2a53 Register utilities app — seed row + capabilities
LXC 127, 10.10.10.127:3080. Six capabilities: readings, meters,
tariffs, reports, estimates, settings. No default Staff grants.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-26 17:33:32 +00:00
0b0a52dd33 Revert Open category back to Operations (autocorrect typo) 2026-07-26 12:47:51 +00:00
b1d8367d89 Group noticeboard, calendar, maintenance under Open sidebar category 2026-07-25 21:43:48 +00:00
9b8feb30f8 Register wages app — seed row + capabilities
Adds wages app (LXC 124, slug wages, Finance category, #065f46) and
4 capabilities: view, budget, sync, settings. No default Staff grants —
management/directors only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-23 09:04:06 +00:00
dc269f13ee Add edit capability to reports app for Directors Forecast
Adds a third capability 'edit' (Edit Directors Forecast) for the reports
app to gate pickup/dry/wet override saves and snapshot creation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-20 10:24:55 +00:00
8f1e985cbc Register directors-report app in auth seed
LXC 123, 10.10.10.123, #7c3aed, FileBarChart icon.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-20 10:10:06 +00:00
9e2a0914a0 Revert restaurant_bookings icon to UtensilsCrossed
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-15 17:41:13 +00:00
ea3a2f46ff Fix restaurant_bookings icon to Armchair (UtensilsCrossed not in iconMap)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-15 17:33:30 +00:00
5673f3e80a Fix reveal-secret: use user_id from JWT payload (not id)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-15 17:22:57 +00:00
ec0eef7de0 Add reveal-secret endpoint — re-verifies admin password before returning CENTRAL_AUTH_SECRET
Used by the settings UI so operators can securely copy the shared session secret
into Hosted Tables without ever exposing it in logs or config files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-15 15:46:39 +00:00
0cd9a34cf0 Add restaurant_bookings app seed + internal PATCH endpoint for Hosted Tables integration
Seeds restaurant_bookings as inactive (active=false) so it stays hidden until the
settings service configures the Hosted Tables URL. Adds PATCH /api/auth/internal/apps/:slug
so settings can update base_path and active without auth restarts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-15 15:41:48 +00:00
104d997824 Remove housekeeping placeholder app from seed
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-14 09:17:58 +00:00
6eece48033 Fix history alias: clear internal_host so management updater ignores it
history is a portal alias for /forecasting/history, not its own service.
Setting internal_host=NULL prevents spurious health-check failures and
deploy attempts against /opt/history on LXC 113.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-13 15:44:35 +00:00
f241539cdb Add History alias app entry pointing to /forecasting/history
Adds a 'history' app slug that deep-links to the forecasting app's
History page, allowing it to appear as a standalone tile in the portal.
Admins grant it alongside the 'forecasting' app via the Roles UI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-13 15:15:43 +00:00
af94b72b02 Add kitchen (10 caps) + kds (3 caps) — Phase 4 stack registration
- Update kitchen app row: teal theme, broader description (invoicing/GP/recipes/menus)
- Add kds app row: LXC 125 @ 10.10.10.125
- Seed kitchen capabilities: view, invoices, invoices_manage, disputes, logbook,
  orders, recipes, menus, manage_flags, settings
- Seed KDS capabilities: view, manage, settings
- Grant Staff role KDS view + manage (needed during live service)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-11 11:26:06 +00:00
d576f103c5 Add cache-bust endpoint — invalidates workforce + smtp creds on demand
Settings service calls POST /api/auth/internal/cache-bust (Bearer SETTINGS_SECRET)
after saving workforce or smtp integrations, so location/credential changes take
effect immediately without waiting for the 5-minute TTL or restarting the container.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-08 11:57:42 +00:00
e97a3dc89f Add rate limiting: login (5 fails/15min per email+IP), register + verify per-IP throttles
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-07 15:51:16 +00:00
276a841adf Email: set Reply-To header from SMTP config
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-07 15:47:11 +00:00
da0f97c47c Workforce: fetch locations individually by ID instead of list endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-07 13:14:11 +00:00
788628485b Add per-app session timeout: max_session_hours column on apps, enforced in /verify
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-07 12:57:13 +00:00
3fae52c36b Workforce: filter departments by configured location_id
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-07 12:52:34 +00:00
9ea567955d Workforce: fetch locations to resolve location names on departments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-07 12:48:43 +00:00
5d6a9ea3cd Workforce: bearer token only, strip OAuth, pass location fields from departments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-07 12:42:47 +00:00
75d373c2c5 Use Workforce bearer token directly if configured, skip OAuth
If a bearer_token is stored in settings, getWorkforceToken() returns it
immediately without doing an OAuth password grant. Validation accepts
either bearer_token or email+password.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-07 12:34:56 +00:00
8d6fd71800 Add reports app registration and capabilities
Registers reports app (LXC 122, /reports, BarChart2, #1d4ed8, Management
category) with two capabilities: view (run reports) and export (CSV download).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-06 12:58:35 +00:00
2f0c9a1b34 Remove view_bookability + view_competitor_rates from forecasting caps
These features have moved to the Rate Monitor app.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-05 12:14:30 +00:00
a4ea1c141e Add Rate Monitor app registration and 6 capabilities
Renames 'Rate Scraper' → 'Rate Monitor', seeds view_own_rates,
view_competitors, view_direct_rates, rate_analysis, manage_scraper,
manage_hotels caps for the rates app (LXC 115).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-05 12:06:54 +00:00
42c1a33c4b Auth seed: include name in ON CONFLICT DO UPDATE so renames take effect on restart
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-04 13:23:15 +00:00
edbaeeda08 Rename housekeeping category to Hotel, HK Planner to Rota Check
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-04 13:19:39 +00:00
a03b065c43 Auth: assignable-users endpoint + maintenance app seed row
GET /api/auth/users?app=<slug> — non-admin user list for task allocation
(requester must have access to the app; returns active users with access,
minimal fields). Seed row for the maintenance app (LXC 121).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 21:29:08 +00:00
608ed4ce19 Auth: refresh JWT on verify so permission changes take effect without re-login
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 21:07:09 +00:00
6e5009b57f Expand cashup caps: history, cash_summary, safe_count
Splits the old 'reports' cap into reports + cash_summary,
'floats' into floats + safe_count, and adds a new 'history' cap.
Existing installs get the three new caps added to the Staff role
via an additive per-cap seed so admin-managed configs are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 14:36:06 +00:00
b5d494a691 Seed hk-planner capabilities: planner + settings
Staff role gets planner by default; settings is admin/explicit-grant only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 14:29:58 +00:00
c7f7079b99 Add per-app granular capabilities (RBAC beyond app access)
Schema:
- app_capabilities: capabilities each app exposes (<app>:<slug>)
- role_capabilities / user_capabilities: grants via roles and direct
- Seed cashup caps (count, finalise, reports, floats, settings)
- Non-breaking migration: default Staff role gets all cashup caps
  except settings (previously only is_admin reached settings)

Resolution:
- getUserCapabilities(): admins get all; others get union of
  role + direct grants, as "<app>:<cap>" strings
- caps[] added to JWT payload (login + register)
- /verify returns live capabilities for the requested app (bare slugs)

Admin API:
- GET /admin/capabilities catalogue
- grant/revoke capability on roles and users
- roles/users GET responses now include their capabilities

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 14:19:08 +00:00
fdbc4df29c Seed hk-planner app (10.10.10.118)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 13:59:02 +00:00
1ae1019ea5 Workforce OAuth: try platform scope for full access
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 01:11:27 +00:00
1c16f0ae9b Workforce OAuth: remove scope restriction to get all permitted scopes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 01:08:31 +00:00