diff --git a/src/Frontend/src/App.vue b/src/Frontend/src/App.vue index 567f2973e6..ccaa60e86a 100644 --- a/src/Frontend/src/App.vue +++ b/src/Frontend/src/App.vue @@ -8,20 +8,21 @@ import LicenseNotifications from "@/components/LicenseNotifications.vue"; import BackendChecksNotifications from "@/components/BackendChecksNotifications.vue"; import { storeToRefs } from "pinia"; import { useAuthStore } from "@/stores/AuthStore"; -import { useUserPermissionsStore } from "@/stores/UserPermissionsStore"; -import { useEnvironmentAndVersionsStore } from "@/stores/EnvironmentAndVersionsStore"; +import { useAllowedRoutes } from "@/composables/useAllowedRoutes"; const authStore = useAuthStore(); const route = useRoute(); const { isAuthenticated, authEnabled } = storeToRefs(authStore); -const permissionsStore = useUserPermissionsStore(); -const environmentStore = useEnvironmentAndVersionsStore(); +// Load the allowed-route manifest (my/routes) once authenticated, so the nav and other +// UI can gate on it. Fail-safe: a missing/old endpoint just leaves the manifest unloaded +// and the UI fails open. +const { fetchManifest } = useAllowedRoutes(); watch( - [authEnabled, isAuthenticated, () => environmentStore.environment.supportsUserPermissions], - ([enabled, authenticated, supported]) => { - if (enabled && authenticated && supported) { - permissionsStore.refresh(); + [authEnabled, isAuthenticated], + ([enabled, authenticated]) => { + if (enabled && authenticated) { + fetchManifest(); } }, { immediate: true } diff --git a/src/Frontend/src/assets/main.css b/src/Frontend/src/assets/main.css index a3bd8e2a06..47c52a772b 100644 --- a/src/Frontend/src/assets/main.css +++ b/src/Frontend/src/assets/main.css @@ -353,6 +353,7 @@ input.check-label { .btn-toolbar > .btn, .btn-toolbar > .btn-group, .btn-toolbar > .input-group, +.btn-toolbar > .permission-gate, .action-btns .btn { margin-left: 0; margin-right: 5px; diff --git a/src/Frontend/src/components/OnOffSwitch.vue b/src/Frontend/src/components/OnOffSwitch.vue index 1042c63cd3..18aa2250d2 100644 --- a/src/Frontend/src/components/OnOffSwitch.vue +++ b/src/Frontend/src/components/OnOffSwitch.vue @@ -1,15 +1,19 @@