diff --git a/CHANGELOG.md b/CHANGELOG.md index e25723cff..2e840e6ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ - updated technical user details with user type and service endpoint fields. Also, updated copy icon color for better view and made copy icon available only when value is available [#1137](https://github.com/eclipse-tractusx/portal-frontend/pull/1137) - **Company Subscriptions** - update API query parameters and fix tab UI scroll [#1131](https://github.com/eclipse-tractusx/portal-frontend/pull/1131) +- **Onboarding Service Provider** + - enhanced permission and company role validation for Onboarding Service Provider [#1176](https://github.com/eclipse-tractusx/portal-frontend/pull/1176) ### Bugfixes diff --git a/DEPENDENCIES b/DEPENDENCIES index ee294e91b..3538e62bf 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -15,7 +15,7 @@ npm/npmjs/-/arg/4.1.3, MIT, approved, clearlydefined npm/npmjs/-/argparse/1.0.10, MIT, approved, #2174 npm/npmjs/-/argparse/2.0.1, Python-2.0, approved, CQ22954 npm/npmjs/-/aria-query/5.1.3, Apache-2.0, approved, clearlydefined -npm/npmjs/-/aria-query/5.3.0, Apache-2.0, approved, clearlydefined +npm/npmjs/-/aria-query/5.3.0, Apache-2.0, approved, #16427 npm/npmjs/-/array-buffer-byte-length/1.0.1, MIT, approved, #7548 npm/npmjs/-/array-includes/3.1.8, MIT, approved, #4577 npm/npmjs/-/array-union/2.1.0, MIT, approved, clearlydefined @@ -696,7 +696,7 @@ npm/npmjs/@react-hook/cache/1.1.1, MIT, approved, clearlydefined npm/npmjs/@react-hook/latest/1.0.3, MIT, approved, clearlydefined npm/npmjs/@reduxjs/toolkit/2.2.7, MIT AND (BSD-2-Clause AND ISC AND MIT) AND Apache-2.0, approved, #14170 npm/npmjs/@remix-run/router/1.15.3, MIT, approved, clearlydefined -npm/npmjs/@rollup/pluginutils/5.1.0, MIT, approved, clearlydefined +npm/npmjs/@rollup/pluginutils/5.1.0, MIT, approved, #16428 npm/npmjs/@rollup/rollup-android-arm-eabi/4.17.2, MIT, approved, clearlydefined npm/npmjs/@rollup/rollup-android-arm64/4.17.2, MIT, approved, clearlydefined npm/npmjs/@rollup/rollup-darwin-arm64/4.17.2, MIT, approved, clearlydefined diff --git a/src/components/shared/frame/Header/index.tsx b/src/components/shared/frame/Header/index.tsx index c792ec88d..d5eb52021 100644 --- a/src/components/shared/frame/Header/index.tsx +++ b/src/components/shared/frame/Header/index.tsx @@ -18,7 +18,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { useState } from 'react' +import { useEffect, useState } from 'react' import { NavLink } from 'react-router-dom' import { useSelector, useDispatch } from 'react-redux' import { Trans, useTranslation } from 'react-i18next' @@ -49,6 +49,8 @@ import RegistrationReviewOverlay from './RegistrationReviewOverlay' import './Header.scss' import RegistrationReviewContent from './RegistrationReviewOverlay/RegistrationReviewContent' import RegistrationDeclinedOverlay from './RegistrationDeclinedOverlay' +import { useFetchOwnCompanyDetailsQuery } from 'features/admin/userApiSlice' +import { PAGES } from 'types/Constants' export const Header = ({ main, @@ -69,11 +71,24 @@ export const Header = ({ const { data } = useFetchApplicationsQuery() const companyData = data?.[0] - + const { data: companyDetails } = useFetchOwnCompanyDetailsQuery('') const [submittedOverlayOpen, setSubmittedOverlayOpen] = useState( companyData?.applicationStatus === ApplicationStatus.SUBMITTED ) const [headerNote, setHeaderNote] = useState(false) + const [pages, setPages] = useState([]) + + useEffect(() => { + if (companyDetails?.companyRole.includes('ONBOARDING_SERVICE_PROVIDER')) { + setPages(user) + } else { + setPages( + user.filter( + (item) => item !== PAGES.MANAGEMENT_ONBOARDING_SERVICE_PROVIDER + ) + ) + } + }, [companyDetails?.companyRole]) const addTitle = (items: Tree[] | undefined) => items?.map( @@ -187,7 +202,7 @@ export const Header = ({ > {t('pages.help')} - + diff --git a/src/types/Config.tsx b/src/types/Config.tsx index c0cdda614..ec79e4e27 100644 --- a/src/types/Config.tsx +++ b/src/types/Config.tsx @@ -599,6 +599,7 @@ export const ALL_PAGES: IPage[] = [ }, { name: PAGES.MANAGEMENT_ONBOARDING_SERVICE_PROVIDER, + allowTo: () => userHasPortalRole(ROLES.CONFIGURE_PARTNER_REGISTRATION), element: , }, ] diff --git a/src/types/Constants.ts b/src/types/Constants.ts index 40d9e282f..0a1ede6c5 100644 --- a/src/types/Constants.ts +++ b/src/types/Constants.ts @@ -233,6 +233,7 @@ export enum ROLES { REVOKE_CREDENTIALS_ISSUER = 'revoke_credentials_issuer', VIEW_REGISTRATION = 'view_registration', READ_PARTNER = 'read_partner', + CONFIGURE_PARTNER_REGISTRATION = 'configure_partner_registration', } export enum HINTS {