[pve-devel] [PATCH v4 manager 15/18] ui: adapt sensible 'root at pam' checks to SU

Oguz Bektas o.bektas at proxmox.com
Thu Jun 2 09:24:47 CEST 2022


Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
* left off ceph since we drop to a /bin/login shell anyways

 www/manager6/lxc/Resources.js  | 6 +++---
 www/manager6/window/Migrate.js | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/www/manager6/lxc/Resources.js b/www/manager6/lxc/Resources.js
index 4b2ae95e..f82d056d 100644
--- a/www/manager6/lxc/Resources.js
+++ b/www/manager6/lxc/Resources.js
@@ -306,9 +306,9 @@ Ext.define('PVE.lxc.RessourceView', {
 	    let isUnusedDisk = key.match(/^unused\d+/);
 	    let isUsedDisk = isDisk && !isUnusedDisk;
 
-	    let noedit = isDelete || !rowdef.editor;
-	    if (!noedit && Proxmox.UserName !== 'root at pam' && key.match(/^mp\d+$/)) {
-		let mp = PVE.Parser.parseLxcMountPoint(value);
+	    var noedit = rec.data.delete || !rowdef.editor;
+	    if (!noedit && !caps.vms['SuperUser'] && key.match(/^mp\d+$/)) { // eslint-disable-line
+		var mp = PVE.Parser.parseLxcMountPoint(value);
 		if (mp.type !== 'volume') {
 		    noedit = true;
 		}
diff --git a/www/manager6/window/Migrate.js b/www/manager6/window/Migrate.js
index 1c23abb3..597e3b0b 100644
--- a/www/manager6/window/Migrate.js
+++ b/www/manager6/window/Migrate.js
@@ -52,8 +52,8 @@ Ext.define('PVE.window.Migrate', {
 		    }
 	    },
 	    setLocalResourceCheckboxHidden: function(get) {
-		if (get('running') || !get('migration.hasLocalResources') ||
-		    Proxmox.UserName !== 'root at pam') {
+		let caps = Ext.state.Manager.get('GuiCap');
+		if (get('running') || !get('migration.hasLocalResources') || !caps.vms['SuperUser']) { // eslint-disable-line
 		    return true;
 		} else {
 		    return false;
-- 
2.30.2





More information about the pve-devel mailing list