Skip to content

Commit

Permalink
fix: disable My Apps button for users without permission (eclipse-tra…
Browse files Browse the repository at this point in the history
  • Loading branch information
shahmargi12 authored and ss-nikunj committed Oct 10, 2024
1 parent 5bbd7f9 commit 01e1577
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/pages/Home/components/StageSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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'),
Expand All @@ -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'),
Expand All @@ -66,6 +70,7 @@ export default function StageSection() {
handleClick: () => {
navigate(t('content.home.stage.slider4.navigation'))
},
hasAccess: userHasPortalRole(ROLES.USERMANAGEMENT_VIEW),
},
]}
stageHeaderInfo={[
Expand Down
3 changes: 3 additions & 0 deletions src/components/shared/frame/SlidingMainHeader/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -44,6 +45,7 @@ export const Header = ({
subTitleTextVariant = 'h2',
buttonText,
handleClick,
hasAccess,
}: HeaderProps) => {
return (
<Box
Expand Down Expand Up @@ -91,6 +93,7 @@ export const Header = ({
onClick={() => {
handleClick()
}}
disabled={!(hasAccess ?? true)}
>
{buttonText}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface SlidingMainHeaderProps {
subTitle: string
imagePath: string
buttonText: string
hasAccess?: boolean
handleClick: () => void
}[]
autoplay?: boolean
Expand Down

0 comments on commit 01e1577

Please sign in to comment.