[pve-devel] [PATCH access-control] RFC: add ls command for pvum user

Dietmar Maurer dietmar at proxmox.com
Mon May 7 14:18:57 CEST 2018


comments inline

> On May 7, 2018 at 2:00 PM Stoiko Ivanov <s.ivanov at proxmox.com> wrote:
> 
> 
> partially addresses #1502
> 
> Given that this is my first patch to this list I would appreciate feedback!
> 
> ---
>  PVE/CLI/pveum.pm | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/PVE/CLI/pveum.pm b/PVE/CLI/pveum.pm
> index a4e584d..f744398 100755
> --- a/PVE/CLI/pveum.pm
> +++ b/PVE/CLI/pveum.pm
> @@ -42,6 +42,25 @@ our $cmddef = {
>  	add    => [ 'PVE::API2::User', 'create_user', ['userid'] ],
>  	modify => [ 'PVE::API2::User', 'update_user', ['userid'] ],
>  	delete => [ 'PVE::API2::User', 'delete_user', ['userid'] ],
> +	ls => [ 'PVE::API2::User', 'index', [], {}, sub {

ls => list

> +	    my $userlist = shift;
> +	    printf "%-30s %-7s\n",
> +	    qw(USERID ENABLED);
> +	    foreach my $user (sort{ $a->{userid} cmp $b->{userid}} @$userlist) {
> +		printf "%-30s %-7d\n", $user->{userid}, $user->{enable}//1;
> +	    }
> +	    } ],
> +	get => [ 'PVE::API2::User', 'read_user', ['userid'], undef, sub {

get => read ?

> +	    my $userdata = shift;
> +	    foreach my $item (sort keys %$userdata) {
> +		if( ref($userdata->{$item}) eq 'ARRAY'){

white space issue, should be

		if (ref($userdata->{$item}) eq 'ARRAY') {




More information about the pve-devel mailing list