Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web-app/src/common/SecureComponent/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,11 @@ export const IAM_PAGES_PERMISSIONS = {
IAM_SCOPES.KMS_KEY_STATUS,
],
[IAM_PAGES.KMS_KEYS_ADD]: [
IAM_SCOPES.KMS_ALL_ACTIONS,
IAM_SCOPES.KMS_LIST_KEYS,
IAM_SCOPES.KMS_CREATE_KEY,
],
[IAM_PAGES.KMS_KEYS_IMPORT]: [
IAM_SCOPES.KMS_ALL_ACTIONS,
IAM_SCOPES.KMS_LIST_KEYS,
IAM_SCOPES.KMS_IMPORT_KEY,
],
[IAM_PAGES.IDP_LDAP_CONFIGURATIONS]: [
Expand Down
84 changes: 48 additions & 36 deletions web-app/src/screens/Console/KMS/ListKeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ const ListKeys = () => {
const deleteKey = hasPermission(CONSOLE_UI_RESOURCE, [
IAM_SCOPES.KMS_DELETE_KEY,
]);
const createKey = hasPermission(CONSOLE_UI_RESOURCE, [
IAM_SCOPES.KMS_CREATE_KEY,
]);

const importKey = hasPermission(CONSOLE_UI_RESOURCE, [
IAM_SCOPES.KMS_IMPORT_KEY,
]);

const displayKeys = hasPermission(CONSOLE_UI_RESOURCE, [
IAM_SCOPES.KMS_LIST_KEYS,
Expand Down Expand Up @@ -111,14 +118,15 @@ const ListKeys = () => {
}
};

const tableActions = [
{
const tableActions: any[] = [];
if (deleteKey) {
tableActions.push({
type: "delete",
onClick: confirmDeleteKey,
sendOnlyId: true,
disableButtonFunction: () => !deleteKey,
},
];
});
}

useEffect(() => {
dispatch(setHelpName("list_keys"));
Expand Down Expand Up @@ -178,39 +186,43 @@ const ListKeys = () => {
/>
</TooltipWrapper>
</SecureComponent>
<SecureComponent
scopes={[IAM_SCOPES.KMS_IMPORT_KEY]}
resource={CONSOLE_UI_RESOURCE}
errorProps={{ disabled: true }}
>
<TooltipWrapper tooltip={"Import Key"}>
<Button
id={"import-key"}
variant={"regular"}
icon={<UploadIcon />}
onClick={() => {
navigate(IAM_PAGES.KMS_KEYS_IMPORT);
}}
/>
</TooltipWrapper>
</SecureComponent>
<SecureComponent
scopes={[IAM_SCOPES.KMS_CREATE_KEY]}
resource={CONSOLE_UI_RESOURCE}
errorProps={{ disabled: true }}
>
<TooltipWrapper tooltip={"Create Key"}>
<Button
id={"create-key"}
label={"Create Key"}
variant={"callAction"}
icon={<AddIcon />}
onClick={() => navigate(IAM_PAGES.KMS_KEYS_ADD)}
/>
</TooltipWrapper>
</SecureComponent>
{importKey ? (
<SecureComponent
scopes={[IAM_SCOPES.KMS_IMPORT_KEY]}
resource={CONSOLE_UI_RESOURCE}
errorProps={{ disabled: true }}
>
<TooltipWrapper tooltip={"Import Key"}>
<Button
id={"import-key"}
variant={"regular"}
icon={<UploadIcon />}
onClick={() => {
navigate(IAM_PAGES.KMS_KEYS_IMPORT);
}}
/>
</TooltipWrapper>
</SecureComponent>
) : null}
{createKey ? (
<SecureComponent
scopes={[IAM_SCOPES.KMS_CREATE_KEY]}
resource={CONSOLE_UI_RESOURCE}
errorProps={{ disabled: true }}
>
<TooltipWrapper tooltip={"Create Key"}>
<Button
id={"create-key"}
label={"Create Key"}
variant={"callAction"}
icon={<AddIcon />}
onClick={() => navigate(IAM_PAGES.KMS_KEYS_ADD)}
/>
</TooltipWrapper>
</SecureComponent>
) : null}
</Grid>
<Grid item xs={12}>
<Grid item xs={12} sx={{ marginTop: "5px" }}>
<SecureComponent
scopes={[IAM_SCOPES.KMS_LIST_KEYS]}
resource={CONSOLE_UI_RESOURCE}
Expand Down