From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 660EBA10A7 for ; Wed, 14 Jun 2023 10:46:55 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 74BA41898C for ; Wed, 14 Jun 2023 10:46:31 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 14 Jun 2023 10:46:27 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id EA75445510 for ; Wed, 14 Jun 2023 10:46:26 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Wed, 14 Jun 2023 10:46:21 +0200 Message-Id: <20230614084622.1446211-22-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230614084622.1446211-1-d.csapak@proxmox.com> References: <20230614084622.1446211-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.015 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH manager v6 15/15] ui: improve permission handling for hardware X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jun 2023 08:46:55 -0000 qemu/HardwareView: with the new Hardware privileges, we want to adapt a few places where we now allow to show the add/edit window with those permissions. form/{PCI,USB}Selector: increase the minHeight property of the PCI/USBSelector, so that the user can see the error message if he has not enough permissions. data/PermPathStore: add '/hardware' to the list of acl paths Signed-off-by: Dominik Csapak --- www/manager6/data/PermPathStore.js | 1 + www/manager6/form/PCISelector.js | 1 + www/manager6/form/USBSelector.js | 1 + www/manager6/qemu/HardwareView.js | 17 +++++++++-------- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/www/manager6/data/PermPathStore.js b/www/manager6/data/PermPathStore.js index cf702c03..c3ac7f0e 100644 --- a/www/manager6/data/PermPathStore.js +++ b/www/manager6/data/PermPathStore.js @@ -8,6 +8,7 @@ Ext.define('PVE.data.PermPathStore', { { 'value': '/access' }, { 'value': '/access/groups' }, { 'value': '/access/realm' }, + { 'value': '/mapping' }, { 'value': '/nodes' }, { 'value': '/pool' }, { 'value': '/sdn/zones' }, diff --git a/www/manager6/form/PCISelector.js b/www/manager6/form/PCISelector.js index 39e111f0..a6e697a4 100644 --- a/www/manager6/form/PCISelector.js +++ b/www/manager6/form/PCISelector.js @@ -37,6 +37,7 @@ Ext.define('PVE.form.PCISelector', { onLoadCallBack: undefined, listConfig: { + minHeight: 80, width: 800, columns: [ { diff --git a/www/manager6/form/USBSelector.js b/www/manager6/form/USBSelector.js index 011778d7..975b2646 100644 --- a/www/manager6/form/USBSelector.js +++ b/www/manager6/form/USBSelector.js @@ -71,6 +71,7 @@ Ext.define('PVE.form.USBSelector', { store: store, emptyText: emptyText, listConfig: { + minHeight: 80, width: 520, columns: [ { diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js index af35a980..5b33b1e2 100644 --- a/www/manager6/qemu/HardwareView.js +++ b/www/manager6/qemu/HardwareView.js @@ -259,8 +259,8 @@ Ext.define('PVE.qemu.HardwareView', { group: 25, order: i, iconCls: 'usb', - editor: caps.nodes['Sys.Console'] ? 'PVE.qemu.USBEdit' : undefined, - never_delete: !caps.nodes['Sys.Console'], + editor: caps.nodes['Sys.Console'] || caps.mapping['Mapping.Use'] ? 'PVE.qemu.USBEdit' : undefined, + never_delete: !caps.nodes['Sys.Console'] && !caps.mapping['Mapping.Use'], header: gettext('USB Device') + ' (' + confid + ')', }; } @@ -270,8 +270,8 @@ Ext.define('PVE.qemu.HardwareView', { group: 30, order: i, tdCls: 'pve-itype-icon-pci', - never_delete: !caps.nodes['Sys.Console'], - editor: caps.nodes['Sys.Console'] ? 'PVE.qemu.PCIEdit' : undefined, + never_delete: !caps.nodes['Sys.Console'] && !caps.mapping['Mapping.Use'], + editor: caps.nodes['Sys.Console'] || caps.mapping['Mapping.Use'] ? 'PVE.qemu.PCIEdit' : undefined, header: gettext('PCI Device') + ' (' + confid + ')', }; } @@ -577,14 +577,15 @@ Ext.define('PVE.qemu.HardwareView', { // heuristic only for disabling some stuff, the backend has the final word. const noSysConsolePerm = !caps.nodes['Sys.Console']; + const noHWPerm = !caps.nodes['Sys.Console'] && !caps.mapping['Mapping.Use']; const noVMConfigHWTypePerm = !caps.vms['VM.Config.HWType']; const noVMConfigNetPerm = !caps.vms['VM.Config.Network']; const noVMConfigDiskPerm = !caps.vms['VM.Config.Disk']; const noVMConfigCDROMPerm = !caps.vms['VM.Config.CDROM']; const noVMConfigCloudinitPerm = !caps.vms['VM.Config.Cloudinit']; - me.down('#addUsb').setDisabled(noSysConsolePerm || isAtUsbLimit()); - me.down('#addPci').setDisabled(noSysConsolePerm || isAtLimit('hostpci')); + me.down('#addUsb').setDisabled(noHWPerm || isAtUsbLimit()); + me.down('#addPci').setDisabled(noHWPerm || isAtLimit('hostpci')); me.down('#addAudio').setDisabled(noVMConfigHWTypePerm || isAtLimit('audio')); me.down('#addSerial').setDisabled(noVMConfigHWTypePerm || isAtLimit('serial')); me.down('#addNet').setDisabled(noVMConfigNetPerm || isAtLimit('net')); @@ -697,14 +698,14 @@ Ext.define('PVE.qemu.HardwareView', { text: gettext('USB Device'), itemId: 'addUsb', iconCls: 'fa fa-fw fa-usb black', - disabled: !caps.nodes['Sys.Console'], + disabled: !caps.nodes['Sys.Console'] && !caps.mapping['Mapping.Use'], handler: editorFactory('USBEdit'), }, { text: gettext('PCI Device'), itemId: 'addPci', iconCls: 'pve-itype-icon-pci', - disabled: !caps.nodes['Sys.Console'], + disabled: !caps.nodes['Sys.Console'] && !caps.mapping['Mapping.Use'], handler: editorFactory('PCIEdit'), }, { -- 2.30.2