Skip to content

Commit

Permalink
fix(kms): change iam perm on serviceKeys
Browse files Browse the repository at this point in the history
ref: MANAGER-15867

Signed-off-by: Vincent BONMARCHAND <[email protected]>
  • Loading branch information
vovh authored and darsene committed Nov 15, 2024
1 parent 1ff8122 commit 8486ffa
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ describe('useServiceKeyActionsList', () => {
keys: [],
createdAt: '2023-01-01T00:00:00Z',
operations: [],
iam: {
id: '8f8a75b0-3bde-4b8d-a8c0-928basvced',
urn:
'urn:v1:eu:resource:okms:8f8a75b0-b57d-45fc-8d4f-256664DFE/serviceKey/dqd63-5688-409c-234-125e24538f34',
displayName: 'ServiceKeyTest',
},
};

const useCases = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ const useServiceKeyActionsList = (
`/${okms.id}/${ROUTES_URLS.keys}/${okmsKey?.id}/${ROUTES_URLS.serviceKeyDeactivate}`,
);
},
iamActions: [kmsIamActions.serviceKeyDeactivate],
urn: okms.iam.urn,
iamActions: [
kmsIamActions.serviceKeyUpdate,
kmsIamActions.serviceKeyDeactivate,
],
urn: okmsKey?.iam.urn,
});
}
if (
Expand All @@ -92,8 +95,11 @@ const useServiceKeyActionsList = (
color: ODS_THEME_COLOR_INTENT.primary,
disabled: updateIsPending,
onClick: () => updateKmsServiceKey({ state: OkmsServiceKeyState.active }),
iamActions: [kmsIamActions.serviceKeyActivate],
urn: okms.iam.urn,
iamActions: [
kmsIamActions.serviceKeyUpdate,
kmsIamActions.serviceKeyActivate,
],
urn: okmsKey?.iam.urn,
});
}
if (
Expand All @@ -108,7 +114,7 @@ const useServiceKeyActionsList = (
okmsKey?.state === OkmsServiceKeyState.active || deleteIsPending,
onClick: () => deleteKmsServiceKey(),
iamActions: [kmsIamActions.serviceKeyDelete],
urn: okms.iam.urn,
urn: okmsKey?.iam.urn,
});
}
return items;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@ export const serviceKeyMock: OkmsAllServiceKeys[] = [
state: OkmsServiceKeyState.active,
type: OkmsKeyTypes.EC,
curve: 'P-256',
iam: {
id: '8f8a75b0-3bde-4b8d-a8c0-928basvced',
urn:
'urn:v1:eu:resource:okms:8f8a75b0-b57d-45fc-8d4f-256664DFE/serviceKey/dqd63-5688-409c-234-125e24538f34',
displayName: 'ServiceKeyTest',
},
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default function Key() {
variant={ODS_BUTTON_VARIANT.stroked}
color={ODS_THEME_COLOR_INTENT.primary}
onClick={() => navigate(ROUTES_URLS.serviceKeyEditName)}
urn={kms.iam.urn}
urn={serviceKey.data.iam.urn}
iamActions={[kmsIamActions.serviceKeyUpdate]}
>
<OsdsIcon
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ColumnSort } from '@ovh-ux/manager-react-components';
import { ColumnSort, IamObject } from '@ovh-ux/manager-react-components';

export type OkmsServiceKeyOptions = {
sorting: ColumnSort;
Expand All @@ -24,6 +24,7 @@ export type OkmsServiceKeyBase = {
state: OkmsServiceKeyState;
type: OkmsKeyTypes;
keys?: any[];
iam: IamObject;
};

/*
Expand Down

0 comments on commit 8486ffa

Please sign in to comment.