import { computed } from 'vue' import { useAuthStore } from '@/stores/auth' /** * Shared role/admin checks for the dominant duplicated permission pattern * (`is_admin || role === 'coordinator'`) found across ~15 components. * Not a generic `can()` — a couple of call sites check genuinely different * things (ownership, a third "developer" role) and are left as-is. */ export function usePermission() { const authStore = useAuthStore() const isAdmin = computed(() => !!authStore.user?.is_admin) const isCoordinatorOrAdmin = computed(() => authStore.user?.role === 'coordinator' || !!authStore.user?.is_admin ) return { isAdmin, isCoordinatorOrAdmin } }