diff --git a/apps/console/src/configs/routes.tsx b/apps/console/src/configs/routes.tsx index 21232dd9679..00cfa164c09 100644 --- a/apps/console/src/configs/routes.tsx +++ b/apps/console/src/configs/routes.tsx @@ -74,6 +74,11 @@ export const getAppViewRoutes = (): RouteInterface[] => { const showStatusLabelForNewAuthzRuntimeFeatures: boolean = window["AppUtils"]?.getConfig()?.ui?.showStatusLabelForNewAuthzRuntimeFeatures; + const isPrivilegedUsersInConsoleSettingsEnabled: boolean = + !window["AppUtils"]?.getConfig()?.ui?.features?.consoleSettings?.disabledFeatures?.includes( + "consoleSettings.privilegedUsers" + ); + const defaultRoutes: RouteInterface[] = [ { category: "extensions:manage.sidePanel.categories.userManagement", @@ -90,7 +95,7 @@ export const getAppViewRoutes = (): RouteInterface[] => { protected: true, showOnSidePanel: false }, - { + !isPrivilegedUsersInConsoleSettingsEnabled && { component: lazy(() => import("@wso2is/admin.administrators.v1/pages/administrator-settings")), exact: true, icon: { @@ -1191,6 +1196,18 @@ export const getAppViewRoutes = (): RouteInterface[] => { path: AppConstants.getPaths().get("CONSOLE_ADMINISTRATORS_EDIT"), protected: true, showOnSidePanel: false + }, + isPrivilegedUsersInConsoleSettingsEnabled && { + component: lazy(() => import("@wso2is/admin.administrators.v1/pages/administrator-settings")), + exact: true, + icon: { + icon: getSidePanelIcons().childIcon + }, + id: "administrator-settings-edit", + name: "administrator-settings-edit", + path: AppConstants.getPaths().get("ADMINISTRATOR_SETTINGS"), + protected: true, + showOnSidePanel: false } ], component: lazy(() => import("@wso2is/admin.console-settings.v1/pages/console-settings-page")), diff --git a/features/admin.administrators.v1/pages/administrator-settings.tsx b/features/admin.administrators.v1/pages/administrator-settings.tsx index ae9b7aa538d..fadb45acfe8 100644 --- a/features/admin.administrators.v1/pages/administrator-settings.tsx +++ b/features/admin.administrators.v1/pages/administrator-settings.tsx @@ -16,14 +16,15 @@ * under the License. */ -import { history, store } from "@wso2is/admin.core.v1"; +import { FeatureAccessConfigInterface } from "@wso2is/access-control"; +import { AppConstants, AppState, history, store } from "@wso2is/admin.core.v1"; import { AlertLevels, IdentifiableComponentInterface } from "@wso2is/core/models"; import { addAlert } from "@wso2is/core/store"; import { DocumentationLink, PageLayout, useDocumentation } from "@wso2is/react-components"; import { AxiosError } from "axios"; import React, { FunctionComponent, ReactElement, SyntheticEvent, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import { useDispatch } from "react-redux"; +import { useDispatch, useSelector } from "react-redux"; import { Dispatch } from "redux"; import { Checkbox, CheckboxProps, Icon, Message } from "semantic-ui-react"; import { updateOrganizationConfigV2 } from "../api/updateOrganizationConfigV2"; @@ -55,6 +56,14 @@ export const AdminSettingsPage: FunctionComponent = const dispatch: Dispatch = useDispatch(); + const consoleSettingsFeatureConfig: FeatureAccessConfigInterface = useSelector( + (state: AppState) => state?.config?.ui?.features?.consoleSettings + ); + const isPrivilegedUsersInConsoleSettingsEnabled: boolean = !consoleSettingsFeatureConfig + ?.disabledFeatures?.includes( + "consoleSettings.privilegedUsers" + ); + const useOrgConfig: UseOrganizationConfigType = useOrganizationConfigV2; const updateOrgConfig: (isEnterpriseLoginEnabled: OrganizationInterface) => Promise = updateOrganizationConfigV2; @@ -155,7 +164,9 @@ export const AdminSettingsPage: FunctionComponent = * This handles back button navigation */ const handleBackButtonClick = () => { - history.push(AdministratorConstants.getPaths().get("COLLABORATOR_USERS_PATH")); + history.push(isPrivilegedUsersInConsoleSettingsEnabled + ? AppConstants.getPaths().get("CONSOLE_SETTINGS") + : AdministratorConstants.getPaths().get("COLLABORATOR_USERS_PATH")); }; /** @@ -197,7 +208,9 @@ export const AdminSettingsPage: FunctionComponent = backButton={ { "data-componentid": `${ testId }-page-back-button`, onClick: handleBackButtonClick, - text: t("extensions:manage.users.administratorSettings.backButton") + text: isPrivilegedUsersInConsoleSettingsEnabled + ? "Go back to console settings" + : "Go back to administrators" } } bottomMargin={ false } contentTopMargin={ true }