Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(frontend): mirror cross-tenant superuser Admin role in UI gates

wizardchen31f560ecf14d
diff --git a/frontend/src/stores/auth.ts b/frontend/src/stores/auth.ts
index b1d4cf3a2..96187cdc1 100644
--- a/frontend/src/stores/auth.ts
+++ b/frontend/src/stores/auth.ts
@@ -114,7 +114,16 @@ export const useAuthStore = defineStore('auth', () => {
: ''
if (!tid) return ''
const match = memberships.value.find((m) => String(m.tenant_id) === tid)
- return match?.role || ''
+ if (match?.role) return match.role
+ // Cross-tenant superuser visiting a tenant they're not a member of:
+ // backend auth.go resolveTenantRole step2 grants a temporary Admin
+ // role without writing tenant_members. Mirror that here so mutation
+ // UIs aren't hidden in tenants the superuser switched into. Never
+ // surface Owner — the backend caps the temporary grant at Admin too
+ // (Owner-only ops like tenant deletion stay reserved for a real
+ // Owner inside the target tenant).
+ if (canAccessAllTenants.value) return 'admin'
+ return ''
})
// hasRole answers "is the current tenant role at least <min>?", used by