fix ux for keys permissions (#3280)
This commit is contained in:
committed by
GitHub
parent
963c8f1221
commit
144904f0f6
@@ -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]: [
|
||||
|
||||
@@ -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,
|
||||
@@ -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"));
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user