so that SUs can perform some root-only actions over the GUI also silence eslint's warning about the access notation for these lines only.
Signed-off-by: Oguz Bektas <o.bek...@proxmox.com> --- v1->v2: * silence eslint warnings * correct the conditional in Migrate.js * remove the unneeded/wrong ones (see fabian's previous review) www/manager6/dc/Config.js | 2 +- www/manager6/lxc/Options.js | 2 +- www/manager6/lxc/Resources.js | 2 +- www/manager6/window/Migrate.js | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js index 9c54b19d..0f70e33e 100644 --- a/www/manager6/dc/Config.js +++ b/www/manager6/dc/Config.js @@ -197,7 +197,7 @@ Ext.define('PVE.dc.Config', { }); } - if (Proxmox.UserName === 'root@pam') { + if (caps.dc['SuperUser']) { // eslint-disable-line me.items.push({ xtype: 'pveACMEClusterView', title: 'ACME', diff --git a/www/manager6/lxc/Options.js b/www/manager6/lxc/Options.js index f2661dfc..dce41505 100644 --- a/www/manager6/lxc/Options.js +++ b/www/manager6/lxc/Options.js @@ -136,7 +136,7 @@ Ext.define('PVE.lxc.Options', { features: { header: gettext('Features'), defaultValue: Proxmox.Utils.noneText, - editor: Proxmox.UserName === 'root@pam' || caps.vms['VM.Allocate'] + editor: caps.vms['SuperUser'] || caps.vms['VM.Allocate'] // eslint-disable-line ? 'PVE.lxc.FeaturesEdit' : undefined, }, hookscript: { diff --git a/www/manager6/lxc/Resources.js b/www/manager6/lxc/Resources.js index 15ee3c67..26e1bd36 100644 --- a/www/manager6/lxc/Resources.js +++ b/www/manager6/lxc/Resources.js @@ -257,7 +257,7 @@ Ext.define('PVE.lxc.RessourceView', { var isUsedDisk = isDisk && !isUnusedDisk; var noedit = rec.data.delete || !rowdef.editor; - if (!noedit && Proxmox.UserName !== 'root@pam' && key.match(/^mp\d+$/)) { + 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@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 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel