[pve-devel] [PATCH manager 7/7] ui: qemu/HardwareView: add CDROM permission check to edit button

Dominik Csapak d.csapak at proxmox.com
Tue Feb 2 14:13:39 CET 2021


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 ?

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'] ||
> +				 (!isCDRom && !diskCap));
>   
>   	    resize_btn.setDisabled(pending || !isUsedDisk || !diskCap);
>   
> 




More information about the pve-devel mailing list