Skip to content

feat(server-app): allow management roles in standalone login - #481

Merged
khaira777 merged 1 commit into
mainfrom
fm/flocafe-serverapp-roles
Aug 23, 2026
Merged

khaira777 merged 1 commit into
mainfrom
fm/flocafe-serverapp-roles

Conversation

@khaira777

Copy link
Copy Markdown
Contributor

Intent

Implement the reviewed plan from the flocafe-serverapp-roles scout report: allow owner and manager to log in to the standalone Server App alongside server, mirroring KDS's front-line+management pattern.

Requirements:

  1. main/server-app.ts: widen SERVER_APP_ALLOWED_ROLES from Set(['server']) to Set(['server', 'manager', 'owner']). Reword the 403 message at both occurrences (requireServerAppAuth middleware and POST /api/auth/login handler) together to name the roles: 'Access denied. Only server, manager, or owner accounts allowed.'
  2. Add i18n key serverApp.loginHint (en: 'Tableside ordering for server, manager, and owner accounts') in all four locales frontend/src/lib/i18n/messages/{en,es,pt,fa}.json inside the existing serverApp block; render it under the login form in frontend/src/app/server-standalone/page.tsx. npm run i18n:check must pass.
  3. tests/server-app-server-role.test.ts: expect 200 for owner and manager logins and verify /api/auth/me works with each token like the existing server assertions; keep 403 for cashier and chef.
    Verified context: no privilege escalation - every proxied endpoint already authorizes manager/owner on the main API; chef is excluded because order creation would 403 at the main API (broken half-working login).

PR body must include: 'Fixes #472-review follow-up; implements captain-requested Server App role alignment' plus 'Refs #438'. Use a descriptive conventional-commit title.

What Changed

Risk Assessment

✅ Low: The bounded role, proxy, localization, and integration-test changes satisfy the stated source requirements; manager and owner requests remain constrained by the main API’s existing role checks.

Testing

Fresh targeted integration, translation, and i18n checks passed. Live API behavior and rendered login/post-login surfaces were verified; generated dependencies, builds, and temporary database data were removed afterward.

Evidence: Server App role API transcript
Live API evidence: owner, manager, and server login returned 200 with /api/auth/me returning 200; cashier and chef returned 403 with the required role message.
  • Evidence: Server App login hint (local file: /Users/gurkiratkhaira/.no-mistakes/evidence/01M0QNYFJ22MWK159HJK7HRADG/server-app-login-en.png)
  • Evidence: Manager Server App session (local file: /Users/gurkiratkhaira/.no-mistakes/evidence/01M0QNYFJ22MWK159HJK7HRADG/server-app-manager-session.png)
  • Outcome: ⚠️ 1 warning across 1 run (9m25s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 warning
  • ⚠️ No pull request exists for fm/flocafe-serverapp-roles, so the required PR body wording cannot be verified. The commit includes Refs refactor(printing): establish multilingual semantic print architecture and extensible templates #438 but not the required follow-up phrase.
  • npm run test:server-app-server-role
  • npm run test:translations
  • npm run i18n:check
  • Live API checks for owner, manager, server, cashier, and chef login plus /api/auth/me
  • Browser login using manager credentials on /server-standalone/
  • Screenshots captured to the evidence directory
  • git diff --check
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ Configured backend and frontend ESLint checks could not run because eslint is not installed in the worktree; no source lint issue was identifiable by inspection.
✅ **Push** - passed

✅ No issues found.

Widen SERVER_APP_ALLOWED_ROLES to server, manager, and owner, mirroring
KDS's front-line + management login pattern. Reword both 403 messages to
name the accepted roles. Add a localized serverApp.loginHint under the
standalone login form in all four locales. Update the role test to expect
200 (with /api/auth/me verification) for owner/manager while cashier and
chef remain 403.

Refs #438
@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR aligns standalone Server App access with the KDS role pattern by admitting server, manager, and owner accounts.

  • Expands the backend role allowlist while retaining cashier and chef exclusions.
  • Adds integration coverage for allowed login and authenticated-session behavior.
  • Adds a localized login hint across all four supported locales.

Confidence Score: 5/5

The PR appears safe to merge, with the expanded roles consistently supported by the standalone UI, proxy routes, and downstream authorization.

Manager and owner sessions follow the same authenticated path as server sessions, and every operation exposed through the standalone proxy already authorizes both management roles.

Important Files Changed

Filename Overview
main/server-app.ts Consistently expands both login and token-validation gates to server, manager, and owner; all proxied downstream routes support the added roles.
frontend/src/app/server-standalone/page.tsx Renders the new localized eligibility hint beneath the login form without changing authentication behavior.
tests/server-app-server-role.test.ts Covers successful login and /api/auth/me access for all three admitted roles while retaining rejection checks for cashier and chef.
frontend/src/lib/i18n/messages/en.json Adds the English Server App login hint with role eligibility matching the backend allowlist.
frontend/src/lib/i18n/messages/es.json Adds the corresponding Spanish login hint.
frontend/src/lib/i18n/messages/fa.json Adds the corresponding Farsi login hint.
frontend/src/lib/i18n/messages/pt.json Adds the corresponding Portuguese login hint.

Reviews (1): Last reviewed commit: "feat(server-app): allow manager and owne..." | Re-trigger Greptile

@khaira777
khaira777 merged commit 706c5f1 into main Aug 23, 2026
13 checks passed
@khaira777
khaira777 deleted the fm/flocafe-serverapp-roles branch August 23, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant