From 9521c452c51f52eea050bae13d25e0b2bededbbf Mon Sep 17 00:00:00 2001 From: Simon Hornby Date: Wed, 26 Apr 2023 10:55:55 +0200 Subject: [PATCH] chore: move google auth ui behind flag (#3606) Moves the access tab for Google Auth behind a flag. The elements are still accessible but hidden by default so this is a soft change. This is a deprecated feature and is on its way out. --- frontend/src/component/admin/auth/AuthSettings.tsx | 5 ++++- frontend/src/interfaces/uiConfig.ts | 1 + src/lib/__snapshots__/create-config.test.ts.snap | 2 ++ src/lib/types/experimental.ts | 4 ++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/src/component/admin/auth/AuthSettings.tsx b/frontend/src/component/admin/auth/AuthSettings.tsx index df267cae2d..35b4b6eddd 100644 --- a/frontend/src/component/admin/auth/AuthSettings.tsx +++ b/frontend/src/component/admin/auth/AuthSettings.tsx @@ -11,6 +11,7 @@ import { TabNav } from 'component/common/TabNav/TabNav/TabNav'; export const AuthSettings = () => { const { authenticationType } = useUiConfig().uiConfig; + const { uiConfig } = useUiConfig(); const tabs = [ { @@ -29,7 +30,9 @@ export const AuthSettings = () => { label: 'Google', component: , }, - ]; + ].filter( + item => uiConfig.flags?.googleAuthEnabled || item.label !== 'Google' + ); return (
diff --git a/frontend/src/interfaces/uiConfig.ts b/frontend/src/interfaces/uiConfig.ts index 307d2b26e8..e1c21447f8 100644 --- a/frontend/src/interfaces/uiConfig.ts +++ b/frontend/src/interfaces/uiConfig.ts @@ -51,6 +51,7 @@ export interface IFlags { demo?: boolean; strategyTitle?: boolean; groupRootRoles?: boolean; + googleAuthEnabled?: boolean; } export interface IVersionInfo { diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index 43a275dbc5..9801dd9fce 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -75,6 +75,7 @@ exports[`should create default config 1`] = ` "embedProxy": true, "embedProxyFrontend": true, "featuresExportImport": true, + "googleAuthEnabled": false, "groupRootRoles": false, "maintenanceMode": false, "messageBanner": false, @@ -101,6 +102,7 @@ exports[`should create default config 1`] = ` "embedProxy": true, "embedProxyFrontend": true, "featuresExportImport": true, + "googleAuthEnabled": false, "groupRootRoles": false, "maintenanceMode": false, "messageBanner": false, diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 5c7712ebd9..14431a2357 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -80,6 +80,10 @@ const flags = { process.env.UNLEASH_STRATEGY_TITLE, false, ), + googleAuthEnabled: parseEnvVarBoolean( + process.env.GOOGLE_AUTH_ENABLED, + false, + ), }; export const defaultExperimentalOptions: IExperimentalOptions = {