From 83a936cd3315372c0635f2bfad4b1d91eb8d3d80 Mon Sep 17 00:00:00 2001 From: Louis King Date: Fri, 24 Jul 2026 20:59:25 +0100 Subject: [PATCH] feat(routes): allow operators to manage routes Operators can now create, edit, and delete routes (previously admin-only). A user may never scope a route above their own role tier: an operator creating/editing an admin-visibility route is rejected (403 on the visibility value, 404 on touching an existing higher-visibility route), preventing them from creating routes they could then never see or modify. - routes.py: RequireAdmin -> RequireOperatorOrAdmin on create/update/delete; add visibility-cap enforcement helpers reusing the existing resolve_user_role / VISIBILITY_LEVELS ladder - web/app.py: proxy access map admits operator for routes POST/PUT/DELETE - Routes.tsx: canManage gate (admin||operator) on Add/Edit/Delete; visibility
@@ -1145,7 +1158,7 @@ export function RoutesPage() { const navigate = useNavigate(); const config = useAppConfig(); const packetsEnabled = config.features?.packets !== false; - const isAdmin = hasRole("admin"); + const canManage = hasRole("admin") || hasRole("operator"); usePageTitle("routes.title"); const queryClient = useQueryClient(); @@ -1468,7 +1481,7 @@ export function RoutesPage() { {error && } - {isAdmin && ( + {canManage && (