From 4675cd82a08f9e6031c532ddcb0497e037f0ea0d Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 16:06:29 +0100 Subject: [PATCH] [v11.1.x] Fix: Do not fetch Orgs if the user is authenticated by apikey/sa or render key (#97261) Fix: Do not fetch Orgs if the user is authenticated by apikey/sa or render key (#97162) * Do not fetch Orgs if the user is authenticated by apikey/sa or render svc * Lint (cherry picked from commit fa634e14765f397e959bbb8f2792176e97ba352b) Co-authored-by: Misi --- .../AppChrome/OrganizationSwitcher/OrganizationSwitcher.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/app/core/components/AppChrome/OrganizationSwitcher/OrganizationSwitcher.tsx b/public/app/core/components/AppChrome/OrganizationSwitcher/OrganizationSwitcher.tsx index 4398ceb1097..d7b91f6c988 100644 --- a/public/app/core/components/AppChrome/OrganizationSwitcher/OrganizationSwitcher.tsx +++ b/public/app/core/components/AppChrome/OrganizationSwitcher/OrganizationSwitcher.tsx @@ -24,7 +24,10 @@ export function OrganizationSwitcher() { } }; useEffect(() => { - if (contextSrv.isSignedIn) { + if ( + contextSrv.isSignedIn && + !(contextSrv.user.authenticatedBy === 'apikey' || contextSrv.user.authenticatedBy === 'render') + ) { dispatch(getUserOrganizations()); } }, [dispatch]);