diff --git a/src/components/pages/Home/components/StageSection/index.tsx b/src/components/pages/Home/components/StageSection/index.tsx index 40d947486..de6345d03 100644 --- a/src/components/pages/Home/components/StageSection/index.tsx +++ b/src/components/pages/Home/components/StageSection/index.tsx @@ -22,6 +22,8 @@ import { useTranslation } from 'react-i18next' import { getAssetBase } from 'services/EnvironmentService' import { SlidingMainHeader } from 'components/shared/frame/SlidingMainHeader/SlidingMainHeader' import { useNavigate } from 'react-router-dom' +import { userHasPortalRole } from 'services/AccessService' +import { ROLES } from 'types/Constants' export default function StageSection() { const { t } = useTranslation() @@ -39,6 +41,7 @@ export default function StageSection() { handleClick: () => { navigate(t('content.home.stage.slider1.navigation')) }, + hasAccess: userHasPortalRole(ROLES.APPMANAGEMENT_VIEW), }, { title: t('content.home.stage.slider2.title'), @@ -57,6 +60,7 @@ export default function StageSection() { handleClick: () => { navigate(t('content.home.stage.slider3.navigation')) }, + hasAccess: userHasPortalRole(ROLES.APPSTORE_VIEW), }, { title: t('content.home.stage.slider4.title'), @@ -66,6 +70,7 @@ export default function StageSection() { handleClick: () => { navigate(t('content.home.stage.slider4.navigation')) }, + hasAccess: userHasPortalRole(ROLES.USERMANAGEMENT_VIEW), }, ]} stageHeaderInfo={[ diff --git a/src/components/shared/frame/SlidingMainHeader/Header.tsx b/src/components/shared/frame/SlidingMainHeader/Header.tsx index a0b51dcf7..16064e7f3 100644 --- a/src/components/shared/frame/SlidingMainHeader/Header.tsx +++ b/src/components/shared/frame/SlidingMainHeader/Header.tsx @@ -31,6 +31,7 @@ export interface HeaderProps { subTitleTextVariant?: 'h1' | 'h2' | 'h3' buttonText?: string handleClick: () => void + hasAccess?: boolean } //TO-DO - Move this component to cx-shared repo after the yarn upgrade @@ -44,6 +45,7 @@ export const Header = ({ subTitleTextVariant = 'h2', buttonText, handleClick, + hasAccess, }: HeaderProps) => { return ( { handleClick() }} + disabled={!(hasAccess ?? true)} > {buttonText} diff --git a/src/components/shared/frame/SlidingMainHeader/SlidingMainHeader.tsx b/src/components/shared/frame/SlidingMainHeader/SlidingMainHeader.tsx index e74a3c919..552e59bc4 100644 --- a/src/components/shared/frame/SlidingMainHeader/SlidingMainHeader.tsx +++ b/src/components/shared/frame/SlidingMainHeader/SlidingMainHeader.tsx @@ -28,6 +28,7 @@ export interface SlidingMainHeaderProps { subTitle: string imagePath: string buttonText: string + hasAccess?: boolean handleClick: () => void }[] autoplay?: boolean