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
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-13065-fixed-1762443312308.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

IAM: incorrect permission check disabled Clone Volume for volume_admin role ([#13065](https://github.com/linode/manager/pull/13065))
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ describe('Volume action menu', () => {
queryMocks.usePermissions.mockReturnValue({
update_volume: true,
attach_volume: true,
create_volume: true,
delete_volume: true,
resize_volume: true,
clone_volume: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const VolumesActionMenu = (props: Props) => {
const isAttached = volume.linode_id !== null;

const { data: accountPermissions } = usePermissions('account', [
'create_volume',
'is_account_admin',
]);
const { data: volumePermissions, isLoading } = usePermissions(
Expand Down Expand Up @@ -97,18 +96,16 @@ export const VolumesActionMenu = (props: Props) => {
: undefined,
},
CLONE: {
disabled:
!volumePermissions?.clone_volume || !accountPermissions?.create_volume,
disabled: !volumePermissions?.clone_volume,
onClick: handlers.handleClone,
title: 'Clone',
tooltip:
!volumePermissions?.clone_volume || !accountPermissions?.create_volume
? getRestrictedResourceText({
action: 'clone',
isSingular: true,
resourceType: 'Volumes',
})
: undefined,
tooltip: !volumePermissions?.clone_volume
? getRestrictedResourceText({
action: 'clone',
isSingular: true,
resourceType: 'Volumes',
})
: undefined,
},
ATTACH: {
disabled: !volumePermissions?.attach_volume,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,11 @@ const initialValues = { label: '' };
export const CloneVolumeDrawer = (props: Props) => {
const { isFetching, onClose: _onClose, open, volume, volumeError } = props;

const { data: accountPermissions } = usePermissions('account', [
'create_volume',
]);
const { data: volumePermissions } = usePermissions(
'volume',
['clone_volume'],
volume?.id
);
const canCloneVolume =
volumePermissions?.clone_volume && accountPermissions?.create_volume;

const { mutateAsync: cloneVolume } = useCloneVolumeMutation();

Expand Down Expand Up @@ -104,7 +99,7 @@ export const CloneVolumeDrawer = (props: Props) => {
title="Clone Volume"
>
<form onSubmit={handleSubmit}>
{!canCloneVolume && (
{!volumePermissions?.clone_volume && (
<Notice
spacingBottom={12}
text="You don't have permission to clone this volume."
Expand All @@ -118,7 +113,7 @@ export const CloneVolumeDrawer = (props: Props) => {
be available in {volume?.region}.
</Typography>
<TextField
disabled={!canCloneVolume}
disabled={!volumePermissions?.clone_volume}
errorText={touched.label ? errors.label : undefined}
label="Label"
name="label"
Expand Down Expand Up @@ -149,7 +144,7 @@ export const CloneVolumeDrawer = (props: Props) => {
/>
<ActionsPanel
primaryButtonProps={{
disabled: !canCloneVolume || isInvalidPrice,
disabled: !volumePermissions?.clone_volume || isInvalidPrice,
label: 'Clone Volume',
loading: isSubmitting,
tooltipText:
Expand Down