Skip to content

Commit 0ae6a20

Browse files
committed
fix
1 parent 9fef1f3 commit 0ae6a20

File tree

6 files changed

+12
-56
lines changed

6 files changed

+12
-56
lines changed

src/components/Ui/Center/Center.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.root {
1+
.wrapper {
22
display: flex;
33
align-items: center;
44
justify-content: center;

src/components/Ui/Center/Center.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export type CenterProps = PropsWithChildren<{
99
}>;
1010

1111
export const Center = ({ children, className, style, textAlignCenter = true }: CenterProps): ReactNode => {
12-
const classes = cx(styles.root, { [styles.textAlignCenter]: textAlignCenter }, className);
12+
const classes = cx(styles.wrapper, { [styles.textAlignCenter]: textAlignCenter }, className);
1313

1414
return (
1515
<div className={classes} style={style}>

src/lib/api/types/crate/controlPlanes.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,13 @@ export interface Metadata {
1212
};
1313
}
1414

15-
export interface Subject {
16-
kind: string;
17-
name: string;
18-
}
19-
20-
export interface RoleBinding {
21-
role: string;
22-
subjects: Subject[];
23-
}
24-
25-
export interface Authorization {
26-
roleBindings: RoleBinding[];
27-
}
28-
2915
export interface ControlPlaneType {
3016
metadata: Metadata;
3117
spec:
3218
| {
3319
authentication: {
3420
enableSystemIdentityProvider?: boolean;
3521
};
36-
authorization?: Authorization;
3722
components: ControlPlaneComponentsType;
3823
}
3924
| undefined;
@@ -100,6 +85,6 @@ export const ControlPlane = (
10085
): Resource<ControlPlaneType> => {
10186
return {
10287
path: `/apis/core.openmcp.cloud/v1alpha1/namespaces/project-${projectName}--ws-${workspaceName}/managedcontrolplanes/${controlPlaneName}`,
103-
jq: '{ spec: .spec | {components, authorization, authentication}, metadata: .metadata | {name, namespace, creationTimestamp, annotations}, status: { conditions: [.status.conditions[] | {type: .type, status: .status, message: .message, reason: .reason, lastTransitionTime: .lastTransitionTime}], access: .status.components.authentication.access, status: .status.status }}',
88+
jq: '{ spec: .spec | {components}, metadata: .metadata | {name, namespace, creationTimestamp, annotations}, status: { conditions: [.status.conditions[] | {type: .type, status: .status, message: .message, reason: .reason, lastTransitionTime: .lastTransitionTime}], access: .status.components.authentication.access, status: .status.status }}',
10489
};
10590
};

src/lib/shared/McpContext.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
import { createContext, ReactNode, useContext } from 'react';
2-
import { ControlPlane as ManagedControlPlaneResource, RoleBinding } from '../api/types/crate/controlPlanes.ts';
2+
import { ControlPlane as ManagedControlPlaneResource } from '../api/types/crate/controlPlanes.ts';
33
import { ApiConfigProvider } from '../../components/Shared/k8s';
44
import { useApiResource } from '../api/useApiResource.ts';
55
import { GetKubeconfig } from '../api/types/crate/getKubeconfig.ts';
66
import { useAuthMcp } from '../../spaces/mcp/auth/AuthContextMcp.tsx';
77
import { BusyIndicator } from '@ui5/webcomponents-react';
8-
import { CRDRequest } from '../api/types/crossplane/CRDList.ts';
98

109
interface Mcp {
1110
project: string;
1211
workspace: string;
1312
name: string;
14-
1513
secretNamespace?: string;
1614
secretName?: string;
1715
secretKey?: string;
1816
kubeconfig?: string;
19-
roleBindings?: RoleBinding[];
2017
}
2118

2219
interface Props {
@@ -46,7 +43,6 @@ export const McpContextProvider = ({ children, context }: Props) => {
4643
return <></>;
4744
}
4845
context.kubeconfig = kubeconfig.data;
49-
context.roleBindings = mcp.data?.spec?.authorization?.roleBindings;
5046
return <McpContext.Provider value={context}>{children}</McpContext.Provider>;
5147
};
5248

src/spaces/mcp/auth/useHasMcpAdminRights.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/spaces/mcp/authorization/ManagedControlPlaneAuthorization.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { ReactNode } from 'react';
2-
import { useGetMcpUserRights } from './useGetMcpUserRights.ts';
32
import { useTranslation } from 'react-i18next';
43

54
import IllustratedError from '../../../components/Shared/IllustratedError.tsx';
6-
import { Button } from '@ui5/webcomponents-react';
5+
import { BusyIndicator, Button } from '@ui5/webcomponents-react';
76
import { ControlPlaneType } from '../../../lib/api/types/crate/controlPlanes.ts';
87
import { generatePath, useNavigate, useParams } from 'react-router-dom';
98
import { Routes } from '../../../Routes.ts';
@@ -16,7 +15,7 @@ export interface ManagedControlPlaneAuthorizationProps {
1615
mcp: ControlPlaneType;
1716
children: ReactNode;
1817
}
19-
export const ManagedControlPlaneAuthorization = ({ children, mcp }: ManagedControlPlaneAuthorizationProps) => {
18+
export const ManagedControlPlaneAuthorization = ({ children }: ManagedControlPlaneAuthorizationProps) => {
2019
const { t } = useTranslation();
2120
const navigate = useNavigate();
2221
const { projectName, workspaceName } = useParams();
@@ -30,12 +29,12 @@ export const ManagedControlPlaneAuthorization = ({ children, mcp }: ManagedContr
3029
}
3130
};
3231

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;
32+
// Check if user has access to CRDs in the MCP's cluster
33+
const { error, isLoading } = useApiResource(CRDRequest);
34+
if (isLoading) {
35+
return <BusyIndicator active />;
36+
}
37+
const isUserNotAuthorized = error?.status === 403 || error?.status === 401;
3938
if (isUserNotAuthorized)
4039
return (
4140
<Center>

0 commit comments

Comments
 (0)