Skip to content

fix(auth): gate /addon-groups in AuthGuard - #1125

Merged
khaira777 merged 2 commits into
mainfrom
fm/flocafe-issue-1079-r1
Oct 13, 2026
Merged

khaira777 merged 2 commits into
mainfrom
fm/flocafe-issue-1079-r1

Conversation

@khaira777

Copy link
Copy Markdown
Contributor

Intent

Verify and implement the surgical fix for FreeOpenSourcePOS/FloCafe issue #1079 ("Renderer AuthGuard missing /addon-groups permission gate"): add /addon-groups to the catalog.manage route permission map in frontend/src/components/layout/AuthGuard.tsx so unauthorized roles (such as server) are redirected by the renderer AuthGuard just like other catalog-managed pages. Deliver via the no-mistakes pipeline as its own PR with Fixes #1079 in the PR summary.

What Changed

  • Add ['/addon-groups', 'catalog.manage'] to PAGE_PERMISSIONS in frontend/src/components/layout/AuthGuard.tsx so unauthorized roles are redirected when navigating to /addon-groups.
  • Update tests/auth-ui-deterministic.test.ts to assert /addon-groups requires catalog.manage and verify each PAGE_PERMISSIONS entry maps its required permission to a valid LANDING_PAGE_CANDIDATES route with a matching permission.

Fixes #1079

Risk Assessment

✅ Low: The change is a minimal, well-bounded addition of /addon-groups to PAGE_PERMISSIONS under catalog.manage in AuthGuard.tsx with corresponding deterministic test coverage.

Testing

Ran targeted deterministic auth and routing suites (test:auth-ui-deterministic, test:desktop-trailing-slash-routing, and test:authorization-permissions), then built the backend and static desktop frontend and drove three live Playwright Chromium scenarios against an isolated tests/e2e-server.cjs instance—confirming with screenshots and trace logs that server (lacking catalog.manage) and a manager with catalog.manage denied via role override are redirected away from /addon-groups (and /addon-groups/) to their respective landing pages (/orders/ and /pos/), while owner (with catalog.manage) remains on /addon-groups/ and renders the Addon Groups UI.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Unauthorized staff role (server, lacking catalog.manage) navigating directly to /addon-groups and /addon-groups/ is redirected by AuthGuard to /orders ✅ pass live ~/.no-mistakes/evidence/01M4VCN3AEBPRT8PMT2P0W5R0R/scenario1-server-redirected-from-addon-groups.png
Authorized staff role (owner, possessing catalog.manage) navigating to /addon-groups remains on /addon-groups and renders the Addon Groups management UI ✅ pass live ~/.no-mistakes/evidence/01M4VCN3AEBPRT8PMT2P0W5R0R/scenario2-owner-allowed-on-addon-groups.png
Staff role (manager) with catalog.manage revoked via a role permission override is redirected by AuthGuard away from /addon-groups to their authorized landing page (/pos) ✅ pass live ~/.no-mistakes/evidence/01M4VCN3AEBPRT8PMT2P0W5R0R/scenario3-manager-denied-override-redirected.png

Server role without catalog.manage redirected from /addon-groups and /addon-groups/ to /orders
Owner role with catalog.manage allowed onto /addon-groups rendering Addon Groups UI
Manager role with catalog.manage denied via role override redirected from /addon-groups to /pos

Evidence: Live browser verification trace log
{
  "timestamp": "2026-10-13T19:55:24.710Z",
  "ports": {
    "mainPort": 52139,
    "kdsPort": 52140,
    "serverAppPort": 52141
  },
  "scenarios": [
    {
      "scenario": "Server role without catalog.manage navigating directly to /addon-groups and /addon-groups/ is redirected to /orders",
      "role": "server",
      "hasCatalogManage": false,
      "initialLandingUrl": "http://127.0.0.1:52139/orders/",
      "afterNoSlashUrl": "http://127.0.0.1:52139/orders/",
      "afterTrailingSlashUrl": "http://127.0.0.1:52139/orders/",
      "screenshot": "~/.no-mistakes/evidence/01M4VCN3AEBPRT8PMT2P0W5R0R/scenario1-server-redirected-from-addon-groups.png",
      "result": "pass"
    },
    {
      "scenario": "Owner role with catalog.manage navigating to /addon-groups stays on /addon-groups and renders Addon Groups management UI",
      "role": "owner",
      "currentUrl": "http://127.0.0.1:52139/addon-groups/",
      "headingText": "Addon Groups",
      "screenshot": "~/.no-mistakes/evidence/01M4VCN3AEBPRT8PMT2P0W5R0R/scenario2-owner-allowed-on-addon-groups.png",
      "result": "pass"
    },
    {
      "scenario": "Manager role with catalog.manage revoked via role permission override is redirected from /addon-groups to /pos",
      "role": "manager (catalog.manage denied)",
      "hasCatalogManage": false,
      "redirectedUrl": "http://127.0.0.1:52139/pos/",
      "screenshot": "~/.no-mistakes/evidence/01M4VCN3AEBPRT8PMT2P0W5R0R/scenario3-manager-denied-override-redirected.png",
      "result": "pass"
    }
  ]
}

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Unauthorized staff role (server, lacking catalog.manage) navigating directly to /addon-groups and /addon-groups/ is redirected by AuthGuard to /orders ✅ pass live ~/.no-mistakes/evidence/01M4VCN3AEBPRT8PMT2P0W5R0R/scenario1-server-redirected-from-addon-groups.png
Authorized staff role (owner, possessing catalog.manage) navigating to /addon-groups remains on /addon-groups and renders the Addon Groups management UI ✅ pass live ~/.no-mistakes/evidence/01M4VCN3AEBPRT8PMT2P0W5R0R/scenario2-owner-allowed-on-addon-groups.png
Staff role (manager) with catalog.manage revoked via a role permission override is redirected by AuthGuard away from /addon-groups to their authorized landing page (/pos) ✅ pass live ~/.no-mistakes/evidence/01M4VCN3AEBPRT8PMT2P0W5R0R/scenario3-manager-denied-override-redirected.png
  • npm run test:auth-ui-deterministic
  • npm run test:desktop-trailing-slash-routing
  • npm run test:authorization-permissions
  • npm run build && npm run build:frontend followed by live Playwright Chromium verification against node tests/e2e-server.cjs for server, owner, and permission-overridden manager roles navigating to /addon-groups and /addon-groups/
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Map /addon-groups to catalog.manage in AuthGuard PAGE_PERMISSIONS so roles without catalog management permission are redirected.

Fixes #1079
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: FreeOpenSourcePOS/FloCafe/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 786df3d0-77cf-4b93-aa4e-34244508bf66

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@khaira777 khaira777 changed the title fix(frontend): gate /addon-groups with catalog.manage in AuthGuard fix(auth): gate /addon-groups in AuthGuard Oct 13, 2026
@khaira777

Copy link
Copy Markdown
Contributor Author

@greptile review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the new page entry uses the existing permission and redirect checks.

Summary

Adds /addon-groups to AuthGuard under catalog.manage.

  • Addon Groups pages now require catalog access.

Reviews (1) · Last reviewed commit: "fix(auth): gate /addon-groups in AuthGua..." · Reviewed by Greptile

@khaira777
khaira777 enabled auto-merge (squash) October 13, 2026 21:10
@khaira777
khaira777 merged commit e5f8fc6 into main Oct 13, 2026
23 checks passed
@khaira777
khaira777 deleted the fm/flocafe-issue-1079-r1 branch October 13, 2026 21:25
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.

fix(auth): map /addon-groups to catalog.manage in AuthGuard PAGE_PERMISSIONS

1 participant