From cf1e4aadf4da945db54a41c134fc47c598581f8a Mon Sep 17 00:00:00 2001 From: GatewayJ <835269233@qq.com> Date: Tue, 21 Apr 2026 09:52:13 +0800 Subject: [PATCH] fix(console): show OIDC account name for console admin users Fetch /accountinfo for all authenticated users after admin is resolved so temporary/OIDC sessions expose account_name from the API. Remove the rustfsAdmin placeholder in the user dropdown. Related: rustfs/rustfs#2612 Made-with: Cursor --- components/user/dropdown.tsx | 2 +- hooks/use-permissions.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/user/dropdown.tsx b/components/user/dropdown.tsx index 6817681..8e8a7df 100644 --- a/components/user/dropdown.tsx +++ b/components/user/dropdown.tsx @@ -91,7 +91,7 @@ export function UserDropdown() {
- {(userInfo as { account_name?: string })?.account_name ?? (isAdmin ? "rustfsAdmin" : "")} + {(userInfo as { account_name?: string })?.account_name ?? ""}
{!isAdmin && ( diff --git a/hooks/use-permissions.tsx b/hooks/use-permissions.tsx index d0b7203..02f4000 100644 --- a/hooks/use-permissions.tsx +++ b/hooks/use-permissions.tsx @@ -126,10 +126,10 @@ export function PermissionsProvider({ children }: { children: React.ReactNode }) }, [api, isAuthenticated, hasResolvedAdmin, fetchAdminStatus]) useEffect(() => { - if (api && isAuthenticated && hasResolvedAdmin && !isAdmin && !hasFetchedPolicy && !isLoading) { + if (api && isAuthenticated && hasResolvedAdmin && !hasFetchedPolicy && !isLoading) { fetchUserPolicy() } - }, [api, isAuthenticated, hasResolvedAdmin, isAdmin, hasFetchedPolicy, isLoading, fetchUserPolicy]) + }, [api, isAuthenticated, hasResolvedAdmin, hasFetchedPolicy, isLoading, fetchUserPolicy]) const canChangePassword = isAdmin || hasPermission(CONSOLE_SCOPES.CONSOLE_ADMIN)