From 684e1d4ce13097b513db6cb09f070262b3f696c7 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 23:24:55 +0300 Subject: [PATCH] [v10.2.x] Identity: Fix org role none comparison (#77001) Identity: Fix org role none comparison (#76999) (cherry picked from commit a174e69c523844ac9dab136c8f9aa584793d8451) Co-authored-by: Juan Cabanas --- public/app/app.ts | 3 ++- public/app/features/live/LiveConnectionWarning.tsx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/app/app.ts b/public/app/app.ts index b910cf67af5..7c4da3f034f 100644 --- a/public/app/app.ts +++ b/public/app/app.ts @@ -15,6 +15,7 @@ import { createRoot } from 'react-dom/client'; import { locationUtil, monacoLanguageRegistry, + OrgRole, setLocale, setTimeZoneResolver, setWeekStart, @@ -279,7 +280,7 @@ function initEchoSrv() { } }); - if (contextSrv.user.orgRole !== '') { + if (contextSrv.user.orgRole !== OrgRole.None) { registerEchoBackend(new PerformanceBackend({})); } diff --git a/public/app/features/live/LiveConnectionWarning.tsx b/public/app/features/live/LiveConnectionWarning.tsx index 5f819597821..ab095d1e7e9 100644 --- a/public/app/features/live/LiveConnectionWarning.tsx +++ b/public/app/features/live/LiveConnectionWarning.tsx @@ -2,7 +2,7 @@ import { css } from '@emotion/css'; import React, { PureComponent } from 'react'; import { Unsubscribable } from 'rxjs'; -import { GrafanaTheme2 } from '@grafana/data'; +import { GrafanaTheme2, OrgRole } from '@grafana/data'; import { config, getGrafanaLiveSrv } from '@grafana/runtime'; import { Alert, stylesFactory } from '@grafana/ui'; import { contextSrv } from 'app/core/services/context_srv'; @@ -46,7 +46,7 @@ export class LiveConnectionWarning extends PureComponent { render() { const { show } = this.state; if (show) { - if (!contextSrv.isSignedIn || !config.liveEnabled || contextSrv.user.orgRole === '') { + if (!contextSrv.isSignedIn || !config.liveEnabled || contextSrv.user.orgRole === OrgRole.None) { return null; // do not show the warning for anonymous users or ones with no org (and /login page etc) }