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

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Jul 27 11:07:32 CEST 2022


On June 2, 2022 9:24 am, Oguz Bektas wrote:
> 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;

nit: why not keep the isDelete like in the rest of the code above?

> +	    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
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 




More information about the pve-devel mailing list