console: fix security tab visibility when login with admin secret on EE

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9397
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
GitOrigin-RevId: 686863dfaa31d9c88f6affae93cdf94ccadbbb5f
This commit is contained in:
Varun Choudhary 2023-06-14 12:23:30 +05:30 committed by hasura-bot
parent ea840f9520
commit c867a47552

View File

@ -15,6 +15,7 @@ import {
prefetchEELicenseInfo,
PageNotFound,
dataHeaders,
loadAdminSecretState,
} from '@hasura/console-legacy-ce';
import {
dataRouterUtils,
@ -65,6 +66,7 @@ import { decodeToken, checkAccess } from './utils/computeAccess';
import preLoginHook from './utils/preLoginHook';
import metricsRouter from './components/Services/Metrics/MetricsRouter';
import { notifyRouteChangeToAppcues } from './utils/appCues';
import extendedGlobals from './Globals';
const routes = store => {
// load hasuractl migration status
@ -289,6 +291,18 @@ const routes = store => {
// ie. admin privileges are already checked in the login process
if (globals.consoleType === 'pro-lite') return; // show security tab
// when consoleType === pro and if admin secret is provided, show security tab
if (
globals.consoleType === 'pro' &&
(extendedGlobals.adminSecret ||
loadAdminSecretState() ||
globals.adminSecret) &&
(extendedGlobals.adminSecret ||
loadAdminSecretState() ||
globals.adminSecret) !== ''
)
return;
// cloud cli doesn't have any privileges when `hasura console` command is executed, it will only have previleges when `hasura pro console` is executed.
// this will make sure that security tab is visible even when the users are running `hasura console` command with valid admin secret
if (globals.consoleType === 'cloud' && globals.consoleMode === 'cli') {