From 73f75b7034e523c26ca15d36965a6b96e445c3be 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:05:49 +0100 Subject: [PATCH] [v10.4.x] Fix: Do not fetch Orgs if the user is authenticated by apikey/sa or render key (#97263) 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]);