From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH manager 7/7] ui: qemu/HardwareView: add CDROM permission check to edit button
Date: Tue, 2 Feb 2021 14:41:13 +0100 [thread overview]
Message-ID: <88f63c1f-c303-85d2-e798-56cccf561e1d@proxmox.com> (raw)
In-Reply-To: <7f0b50fd-2620-226f-8341-ca21b7bdd45c@proxmox.com>
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@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@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
next prev parent reply other threads:[~2021-02-02 13:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 14:21 [pve-devel] [PATCH manager 0/7] ui: qemu/HardwareView: fix GUI permission checks and make eslint happier Aaron Lauterer
2021-02-01 14:21 ` [pve-devel] [PATCH manager 1/7] ui: qemu/HardwareView: eslint: enforce "no-mixed-operators" rule Aaron Lauterer
2021-02-03 7:37 ` [pve-devel] applied: " Thomas Lamprecht
2021-02-01 14:21 ` [pve-devel] [PATCH manager 2/7] ui: qemu/HardwareView: eslint: enforce "max-len" rule Aaron Lauterer
2021-02-03 7:40 ` Thomas Lamprecht
2021-02-03 9:50 ` Aaron Lauterer
2021-02-03 9:54 ` Aaron Lauterer
2021-02-01 14:21 ` [pve-devel] [PATCH manager 3/7] ui: qemu/HardwareView: eslint: enforce "no-useless-concat" rule Aaron Lauterer
2021-02-02 13:06 ` Dominik Csapak
2021-02-03 5:11 ` Thomas Lamprecht
2021-02-01 14:21 ` [pve-devel] [PATCH manager 4/7] ui: qemu/HardwareView: eslint: enforce "no-shadow" rule Aaron Lauterer
2021-02-02 13:07 ` Dominik Csapak
2021-02-03 6:18 ` Thomas Lamprecht
2021-02-01 14:21 ` [pve-devel] [PATCH manager 5/7] ui: qemu/HardwareView: change heuristic perms to const Aaron Lauterer
2021-02-03 7:37 ` [pve-devel] applied: " Thomas Lamprecht
2021-02-01 14:21 ` [pve-devel] [PATCH manager 6/7] ui: qemu/HardwareView: check EFI Disk button permissions Aaron Lauterer
2021-02-03 7:37 ` [pve-devel] applied: " Thomas Lamprecht
2021-02-01 14:21 ` [pve-devel] [PATCH manager 7/7] ui: qemu/HardwareView: add CDROM permission check to edit button Aaron Lauterer
2021-02-02 13:13 ` Dominik Csapak
2021-02-02 13:41 ` Aaron Lauterer [this message]
2021-02-03 6:21 ` Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=88f63c1f-c303-85d2-e798-56cccf561e1d@proxmox.com \
--to=a.lauterer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal