@@ -9,6 +9,8 @@ import { generatePath, useNavigate, useParams } from 'react-router-dom';
99import { Routes } from '../../../Routes.ts' ;
1010
1111import { Center } from '../../../components/Ui/Center/Center.tsx' ;
12+ import { CRDRequest } from '../../../lib/api/types/crossplane/CRDList.ts' ;
13+ import { useApiResource } from '../../../lib/api/useApiResource.ts' ;
1214
1315export interface ManagedControlPlaneAuthorizationProps {
1416 mcp : ControlPlaneType ;
@@ -27,30 +29,19 @@ export const ManagedControlPlaneAuthorization = ({ children, mcp }: ManagedContr
2729 ) ;
2830 }
2931 } ;
30- const createdBy =
31- mcp ?. metadata ?. annotations ?. [ 'openmcp.cloud/created-by' ] ?. split ( ':' ) [ 1 ] ||
32- t ( 'mcp.authorization.accessDenied.administrator' ) ;
33- const isSystemIdentityProviderEnabled = Boolean ( mcp . spec ?. authentication ?. enableSystemIdentityProvider ) ;
34- const { isMcpMember } = useGetMcpUserRights ( ) ;
35- if ( ! isSystemIdentityProviderEnabled )
36- return (
37- < Center >
38- < IllustratedError
39- title = { t ( 'mcp.authorization.customIdp.title' ) }
40- details = { t ( 'mcp.authorization.customIdp.details' ) }
41- />
42- < Button design = { 'Default' } icon = { 'navigation-left-arrow' } onClick = { onBack } >
43- { t ( 'mcp.authorization.backToWorkspaces' ) }
44- </ Button >
45- </ Center >
46- ) ;
4732
48- if ( ! isMcpMember )
33+ const { error : crdError , data : crdData } = useApiResource ( CRDRequest ) ;
34+ console . log ( 'crdError:' ) ;
35+ console . log ( crdError ?. status ) ;
36+ console . log ( 'crdData:' ) ;
37+ console . log ( crdData ) ;
38+ const isUserNotAuthorized = crdError ?. status === 403 || crdError ?. status === 401 ;
39+ if ( isUserNotAuthorized )
4940 return (
5041 < Center >
5142 < IllustratedError
5243 title = { t ( 'mcp.authorization.accessDenied.title' ) }
53- details = { t ( 'mcp.authorization.accessDenied.details' , { createdBy } ) }
44+ details = { t ( 'mcp.authorization.accessDenied.details' ) }
5445 />
5546 < Button design = { 'Default' } icon = { 'navigation-left-arrow' } onClick = { onBack } >
5647 { t ( 'mcp.authorization.backToWorkspaces' ) }
0 commit comments