[pve-devel] [PATCH manager] fix #1814: do not enable disk related buttons for audit user
Dominik Csapak
d.csapak at proxmox.com
Tue Apr 9 13:56:56 CEST 2019
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/lxc/Resources.js | 8 +++++---
www/manager6/qemu/HardwareView.js | 12 ++++++++----
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/www/manager6/lxc/Resources.js b/www/manager6/lxc/Resources.js
index 65e4f641..f2c8d05d 100644
--- a/www/manager6/lxc/Resources.js
+++ b/www/manager6/lxc/Resources.js
@@ -31,6 +31,7 @@ Ext.define('PVE.lxc.RessourceView', {
}
var caps = Ext.state.Manager.get('GuiCap');
+ var diskCap = caps.vms['VM.Config.Disk'];
var mpeditor = caps.vms['VM.Config.Disk'] ? 'PVE.lxc.MountPointEdit' : undefined;
@@ -238,9 +239,9 @@ Ext.define('PVE.lxc.RessourceView', {
}
edit_btn.setDisabled(noedit);
- remove_btn.setDisabled(!isDisk || rec.data.key === 'rootfs');
- resize_btn.setDisabled(!isDisk);
- move_btn.setDisabled(!isDisk);
+ remove_btn.setDisabled(!isDisk || rec.data.key === 'rootfs' || !diskCap);
+ resize_btn.setDisabled(!isDisk || !diskCap);
+ move_btn.setDisabled(!isDisk || !diskCap);
};
@@ -277,6 +278,7 @@ Ext.define('PVE.lxc.RessourceView', {
tbar: [
{
text: gettext('Add'),
+ disabled: !diskCap,
menu: new Ext.menu.Menu({
items: [
{
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index ba588e37..f60ac7e3 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -51,6 +51,7 @@ Ext.define('PVE.qemu.HardwareView', {
}
var caps = Ext.state.Manager.get('GuiCap');
+ var diskCap = caps.vms['VM.Config.Disk'];
/*jslint confusion: true */
var rows = {
@@ -325,6 +326,9 @@ Ext.define('PVE.qemu.HardwareView', {
var editor = rowdef.editor;
if (rowdef.tdCls == 'pve-itype-icon-storage') {
+ if (!diskCap) {
+ return;
+ }
var value = me.getObjectValue(rec.data.key, '', true);
if (value.match(/vm-.*-cloudinit/)) {
return;
@@ -581,15 +585,15 @@ Ext.define('PVE.qemu.HardwareView', {
var isEfi = (key === 'efidisk0');
- remove_btn.setDisabled(rec.data['delete'] || (rowdef.never_delete === true));
+ remove_btn.setDisabled(rec.data['delete'] || (rowdef.never_delete === true) || (isUnusedDisk && !diskCap));
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);
+ edit_btn.setDisabled(rec.data['delete'] || !rowdef.editor || isCloudInit || !diskCap);
- resize_btn.setDisabled(pending || !isUsedDisk);
+ resize_btn.setDisabled(pending || !isUsedDisk || !diskCap);
- move_btn.setDisabled(pending || !isUsedDisk);
+ move_btn.setDisabled(pending || !isUsedDisk || !diskCap);
revert_btn.setDisabled(!pending);
--
2.11.0
More information about the pve-devel
mailing list