mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 14:32:03 +00:00
fix(modules): let the record's own module map close its pages for a delegate too
Six page gates read `inSharedRecord || user?.modules?.X`, with a comment saying the delegate's own module map does not govern the owner's record. That was true when it was written and stopped being true in v1.38.14: `GET /api/auth/me` now publishes the RECORD's map, masked to what the grant opens, so the prefix that protected against reading the wrong map now widens the gate instead. The navigation drops the entry correctly while a typed URL still renders the page for a record whose owner switched the module off, and `/api/vaccinations` carries no module gate of its own, so it renders and works. Deleting the prefix answers both cases from the one map, which is what it is for. A structural guard holds the six expressions: it locates each gate, proves it is a module gate, and then asserts it does not widen on the sharing question. It finds nothing to assert on if the expression moves, and says so, rather than passing on an empty match. All six legs fail against the previous gates.
This commit is contained in:
1 parent
e7a1950f3a
commit
0ee26625be
7 files changed
+72
-20
No files matched your search
@@ -251,8 +251,7 @@ export function DocumentsView() {
|
||||
const queryClient = useQueryClient();
|
||||
const coachLaunch = useCoachLaunch();
|
||||
|
||||
const moduleEnabled =
|
||||
inSharedRecord || user?.modules?.inboundDocuments === true;
|
||||
const moduleEnabled = user?.modules?.inboundDocuments === true;
|
||||
|
||||
// UX redirect only — the API routes enforce the gate server-side.
|
||||
useEffect(() => {
|
||||
|
||||
Reference in new issue
Block a user