[pve-devel] [PATCH manager 7/7] ui: qemu/HardwareView: add CDROM permission check to edit button
Aaron Lauterer
a.lauterer at proxmox.com
Tue Feb 2 14:41:13 CET 2021
On 2/2/21 2:13 PM, Dominik Csapak wrote:
> well this is hardly readable anymore... (not your fault)
> but, would it now not be disabled if i have no CDROM perms
> even if it is a disk and i have perms for that,
> because of short-circuiting ?
Oh yeah, thanks for catching that. One more comment inline
>
> On 2/1/21 3:21 PM, Aaron Lauterer wrote:
>> Add CDROM permission check to disable the Edit button if they are not
>> present.
>>
>> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
>> ---
>> www/manager6/qemu/HardwareView.js | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
>> index 252a8e72..56bdc0a1 100644
>> --- a/www/manager6/qemu/HardwareView.js
>> +++ b/www/manager6/qemu/HardwareView.js
>> @@ -600,7 +600,11 @@ Ext.define('PVE.qemu.HardwareView', {
>> remove_btn.setText(isUsedDisk && !isCloudInit ? remove_btn.altText : remove_btn.defaultText);
>> remove_btn.RESTMethod = isUnusedDisk ? 'POST':'PUT';
>> - edit_btn.setDisabled(rec.data.delete || !rowdef.editor || isCloudInit || (!isCDRom && !diskCap));
>> + edit_btn.setDisabled(rec.data.delete ||
>> + !rowdef.editor ||
>> + isCloudInit ||
>> + !caps.vms['VM.Config.CDROM'] ||
It doesn't really help readability but should work if we additionally check if the current selection is a cdrom. This should prevent short-circuiting in that case
(isCDRom && !caps.vms['VM.Config.CDROM'])) ||
>> + (!isCDRom && !diskCap));
>> resize_btn.setDisabled(pending || !isUsedDisk || !diskCap);
>>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
More information about the pve-devel
mailing list