feat(client): let a managed route require an admin

Hiding the nav entry is not access control: the path stays typeable, and a screen
about how the install is run should not open for somebody who was invited to one
trip. ProtectedRoute already knows how to refuse — the attachment point just was
not asking it to.

Optional, so a route that does not set it behaves exactly as before. It sits
next to adminOnly on the nav entry rather than being derived from it, because
the two answer different questions: who is offered the door, and who may walk
through it.
This commit is contained in:
Maurice
2026-08-15 17:05:44 +02:00
committed by Maurice
parent 7c378c574f
commit 887e6c5026
2 changed files with 10 additions and 1 deletions
+1 -1
View File
@@ -479,7 +479,7 @@ export default function App() {
<Route
key={r.path}
path={r.path}
element={<ProtectedRoute>{r.element}</ProtectedRoute>}
element={<ProtectedRoute adminRequired={r.adminOnly}>{r.element}</ProtectedRoute>}
/>
))}
<Route
+9
View File
@@ -29,6 +29,15 @@ export interface ManagedRoute {
path: string
/** Rendered inside the app's ProtectedRoute wrapper, like every other screen. */
element: ReactElement
/**
* Refuse the route to anyone but an admin, the same way /admin does.
*
* Hiding the nav entry is not access control — the path is still typeable, and
* a screen about how the install is run should not open for a traveller who
* was invited to one trip. Set this alongside `adminOnly` on the matching nav
* entry; the two answer different questions.
*/
adminOnly?: boolean
}
export interface ManagedNavItem {