From 9b5b0163f64702e58ac64c0cf9da97fef17929e1 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:07:56 +0100 Subject: [PATCH] [v11.2.x] Fix: Do not fetch Orgs if the user is authenticated by apikey/sa or render key (#97264) 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 afd5fd3d354..18f716fc4ce 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]);