From 4ca3535e6df18b94d896fb3cc8cbc421b428473a Mon Sep 17 00:00:00 2001 From: Karel Hala Date: Tue, 22 Oct 2024 10:51:54 +0200 Subject: [PATCH 1/2] Fix user access location in settings icon --- src/components/Header/Tools.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Header/Tools.tsx b/src/components/Header/Tools.tsx index e954bf4bb..d522ec00c 100644 --- a/src/components/Header/Tools.tsx +++ b/src/components/Header/Tools.tsx @@ -75,8 +75,10 @@ const Tools = () => { const unreadNotifications = useAtomValue(unreadNotificationsAtom); const [isNotificationDrawerExpanded, toggleNotifications] = useAtom(notificationDrawerExpandedAtom); const intl = useIntl(); + const auth = useContext(ChromeAuthContext); + const isOrgAdmin = auth?.user?.identity?.user?.is_org_admin; const settingsPath = isITLessEnv ? `/settings/my-user-access` : enableIntegrations ? `/settings/integrations` : '/settings/sources'; - const identityAndAccessManagmentPath = '/iam/user-access/overview'; + const identityAndAccessManagmentPath = isOrgAdmin ? '/iam/user-access/overview' : '/iam/my-user-access'; const betaSwitcherTitle = `${isPreview ? intl.formatMessage(messages.stopUsing) : intl.formatMessage(messages.use)} ${intl.formatMessage( messages.betaRelease )}`; @@ -113,7 +115,7 @@ const Tools = () => { items: [ { url: identityAndAccessManagmentPath, - title: 'User Access', + title: isOrgAdmin ? 'User Access' : 'My User Access', }, { url: '/iam/authentication-policy/authentication-factors', From 5e74598e791dcb334ed45b5d609c6ec7830736ba Mon Sep 17 00:00:00 2001 From: Karel Hala Date: Tue, 22 Oct 2024 11:01:23 +0200 Subject: [PATCH 2/2] Adjust access management link in settings icon --- src/components/Header/Tools.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Header/Tools.tsx b/src/components/Header/Tools.tsx index d522ec00c..f4a8db629 100644 --- a/src/components/Header/Tools.tsx +++ b/src/components/Header/Tools.tsx @@ -70,15 +70,17 @@ const Tools = () => { const isPreview = useAtomValue(isPreviewAtom); const togglePreviewWithCheck = useSetAtom(togglePreviewWithCheckAtom); const enableIntegrations = useFlag('platform.sources.integrations'); + const workspacesEnabled = useFlag('platform.rbac.workspaces'); const enableGlobalLearningResourcesPage = useFlag('platform.learning-resources.global-learning-resources'); const { user, token } = useContext(ChromeAuthContext); const unreadNotifications = useAtomValue(unreadNotificationsAtom); const [isNotificationDrawerExpanded, toggleNotifications] = useAtom(notificationDrawerExpandedAtom); const intl = useIntl(); - const auth = useContext(ChromeAuthContext); - const isOrgAdmin = auth?.user?.identity?.user?.is_org_admin; + const isOrgAdmin = user?.identity?.user?.is_org_admin; const settingsPath = isITLessEnv ? `/settings/my-user-access` : enableIntegrations ? `/settings/integrations` : '/settings/sources'; - const identityAndAccessManagmentPath = isOrgAdmin ? '/iam/user-access/overview' : '/iam/my-user-access'; + const identityAndAccessManagmentPath = isOrgAdmin + ? `/iam/${workspacesEnabled ? 'access-management' : 'user-access'}/overview` + : '/iam/my-user-access'; const betaSwitcherTitle = `${isPreview ? intl.formatMessage(messages.stopUsing) : intl.formatMessage(messages.use)} ${intl.formatMessage( messages.betaRelease )}`; @@ -115,7 +117,7 @@ const Tools = () => { items: [ { url: identityAndAccessManagmentPath, - title: isOrgAdmin ? 'User Access' : 'My User Access', + title: isOrgAdmin ? (workspacesEnabled ? 'Acess management' : 'User Access') : 'My User Access', }, { url: '/iam/authentication-policy/authentication-factors',