Repository navigation
fix(auth): gate /addon-groups in AuthGuard - #1125
Conversation
Map /addon-groups to catalog.manage in AuthGuard PAGE_PERMISSIONS so roles without catalog management permission are redirected. Fixes #1079
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
@greptile review |
|
Intent
Verify and implement the surgical fix for FreeOpenSourcePOS/FloCafe issue #1079 ("Renderer AuthGuard missing /addon-groups permission gate"): add
/addon-groupsto thecatalog.manageroute permission map infrontend/src/components/layout/AuthGuard.tsxso unauthorized roles (such asserver) are redirected by the rendererAuthGuardjust like other catalog-managed pages. Deliver via theno-mistakespipeline as its own PR withFixes #1079in the PR summary.What Changed
['/addon-groups', 'catalog.manage']toPAGE_PERMISSIONSinfrontend/src/components/layout/AuthGuard.tsxso unauthorized roles are redirected when navigating to/addon-groups.tests/auth-ui-deterministic.test.tsto assert/addon-groupsrequirescatalog.manageand verify eachPAGE_PERMISSIONSentry maps its required permission to a validLANDING_PAGE_CANDIDATESroute with a matching permission.Fixes #1079
Risk Assessment
✅ Low: The change is a minimal, well-bounded addition of
/addon-groupstoPAGE_PERMISSIONSundercatalog.manageinAuthGuard.tsxwith corresponding deterministic test coverage.Testing
Ran targeted deterministic auth and routing suites (
test:auth-ui-deterministic,test:desktop-trailing-slash-routing, andtest:authorization-permissions), then built the backend and static desktop frontend and drove three live Playwright Chromium scenarios against an isolatedtests/e2e-server.cjsinstance—confirming with screenshots and trace logs thatserver(lackingcatalog.manage) and amanagerwithcatalog.managedenied via role override are redirected away from/addon-groups(and/addon-groups/) to their respective landing pages (/orders/and/pos/), whileowner(withcatalog.manage) remains on/addon-groups/and renders the Addon Groups UI.Evidence: Live browser verification trace log
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.
npm run test:auth-ui-deterministicnpm run test:desktop-trailing-slash-routingnpm run test:authorization-permissionsnpm run build && npm run build:frontendfollowed by live Playwright Chromium verification againstnode tests/e2e-server.cjsforserver,owner, and permission-overriddenmanagerroles navigating to/addon-groupsand/addon-groups/✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.