[pbs-devel] [v2 proxmox-backup] www: show more ACLs in datastore panel

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Nov 9 19:56:52 CET 2020


On 09.11.20 14:47, Fabian Grünbichler wrote:
> since just the ACLs defined on the exact datastore path don't give
> anywhere near a complete picture of who has access to it.
> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
> ---
> 
> Notes:
>     v2: handle neighbouring ACL paths properly
> 
>  www/config/ACLView.js  | 20 +++++++++++++++++++-
>  www/datastore/Panel.js |  1 -
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/www/config/ACLView.js b/www/config/ACLView.js
> index bf1ea6a9..20caf284 100644
> --- a/www/config/ACLView.js
> +++ b/www/config/ACLView.js
> @@ -84,11 +84,29 @@ Ext.define('PBS.config.ACLView', {
>  
>  	    let params = {};
>  	    if (view.aclPath !== undefined) {
> -		params.path = view.aclPath;
> +
> +		let pathFilter = Ext.create('Ext.util.Filter', {
> +		    filterPath: view.aclPath,
> +		    filterFn: function(item) {
> +			let me = this;
> +			let curr = item.data.path;
> +
> +			if (curr.lastIndexOf("/") < me.filterPath.lastIndexOf("/")) {
> +			    return me.filterPath.startsWith(curr);
> +			} else {
> +			    return me.filterPath === curr;
> +			}


argh, this gets it wrong too, e.g. if one passes /datastore as filter get
only the /datastore ACLs, but not / or /datastore/test ones.

We probably need to split both filter and current path into components
.split('/') and go through them, return false if filter components are
not yet exhausted and the current level does not match, else return true.


> +		    },
> +		});
> +		view.getStore().addFilter(pathFilter);
>  	    }
>  	    if (view.aclExact !== undefined) {
> +		if (view.aclPath !== undefined) {
> +		    params.path = view.aclPath;
> +		}
>  		params.exact = view.aclExact;
>  	    }
> +
>  	    proxy.setExtraParams(params);
>  	    Proxmox.Utils.monStoreErrors(view, view.getStore().rstore);
>  	},
> diff --git a/www/datastore/Panel.js b/www/datastore/Panel.js
> index 473aa50c..bca663e8 100644
> --- a/www/datastore/Panel.js
> +++ b/www/datastore/Panel.js
> @@ -90,7 +90,6 @@ Ext.define('PBS.DataStorePanel', {
>  	    itemId: 'acl',
>  	    xtype: 'pbsACLView',
>  	    iconCls: 'fa fa-unlock',
> -	    aclExact: true,
>  	    cbind: {
>  		aclPath: '{aclPath}',
>  	    },
> 







More information about the pbs-devel mailing list