[pve-devel] [PATCH v2 manager 4/4] lxc: disable edit button for non-root users for bindmounts

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Feb 23 15:00:22 CET 2016


---
 www/manager/lxc/Resources.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/www/manager/lxc/Resources.js b/www/manager/lxc/Resources.js
index 396b6f9..7ddb0dc 100644
--- a/www/manager/lxc/Resources.js
+++ b/www/manager/lxc/Resources.js
@@ -223,7 +223,13 @@ Ext.define('PVE.lxc.RessourceView', {
 
 	    var isDisk = (rowdef.tdCls == 'pve-itype-icon-storage');
 
-	    edit_btn.setDisabled(rec.data['delete'] || !rowdef.editor);
+	    var noedit = rec.data['delete'] || !rowdef.editor;
+	    if (!noedit && PVE.UserName !== 'root at pam' && key.match(/^mp\d+$/)) {
+		var mp = PVE.Parser.parseLxcMountPoint(value);
+		if (mp.type !== 'volume')
+		    noedit = true;
+	    }
+	    edit_btn.setDisabled(noedit);
 
 	    remove_btn.setDisabled(!isDisk || rec.data.key === 'rootfs');
 	    resize_btn.setDisabled(!isDisk);
-- 
2.1.4





More information about the pve-devel mailing list