[pve-devel] [PATCH manager v2 2/2] ui: cloudinit: disallow unprivileged users to regenerate images
Daniel Kral
d.kral at proxmox.com
Thu Nov 7 15:40:55 CET 2024
Disables the "Regenerate image" button in the VM CloudInit tab for
users, which lack the necessary permission "VM.Config.CloudInit" for the
CloudInit update API endpoint.
This is a cosmetic change as the CloudInit update API endpoint would
fail because of insufficient permissions anyway.
Signed-off-by: Daniel Kral <d.kral at proxmox.com>
---
Changes since v1:
- remove the now unnecessary permission "VM.Config.CDROM"
www/manager6/qemu/CloudInit.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/www/manager6/qemu/CloudInit.js b/www/manager6/qemu/CloudInit.js
index be902d43..ccad4916 100644
--- a/www/manager6/qemu/CloudInit.js
+++ b/www/manager6/qemu/CloudInit.js
@@ -120,7 +120,10 @@ Ext.define('PVE.qemu.CloudInit', {
}
});
- me.down('#savebtn').setDisabled(!found);
+ let caps = Ext.state.Manager.get('GuiCap');
+ let canRegenerateImage = !!caps.vms['VM.Config.Cloudinit'];
+ me.down('#savebtn').setDisabled(!found || !canRegenerateImage);
+
me.setDisabled(!found);
if (!found) {
me.getView().mask(gettext('No CloudInit Drive found'), ['pve-static-mask']);
--
2.39.5
More information about the pve-devel
mailing list