mirror of
https://git.proxmox.com/git/pve-access-control
synced 2025-08-08 00:57:43 +00:00
code cleanup
This commit is contained in:
parent
399932c682
commit
cab28ea50b
@ -14,22 +14,6 @@ use PVE::RESTHandler;
|
|||||||
|
|
||||||
use base qw(PVE::RESTHandler);
|
use base qw(PVE::RESTHandler);
|
||||||
|
|
||||||
my $extract_pool_data = sub {
|
|
||||||
my ($data, $full) = @_;
|
|
||||||
|
|
||||||
my $res = {};
|
|
||||||
|
|
||||||
$res->{comment} = $data->{comment} if defined($data->{comment});
|
|
||||||
|
|
||||||
return $res if !$full;
|
|
||||||
|
|
||||||
$res->{vms} = $data->{vms} ? [ keys %{$data->{vms}} ] : [];
|
|
||||||
|
|
||||||
$res->{storages} = $data->{storage} ? [ keys %{$data->{storage}} ] : [];
|
|
||||||
|
|
||||||
return $res;
|
|
||||||
};
|
|
||||||
|
|
||||||
__PACKAGE__->register_method ({
|
__PACKAGE__->register_method ({
|
||||||
name => 'index',
|
name => 'index',
|
||||||
path => '',
|
path => '',
|
||||||
@ -61,9 +45,10 @@ __PACKAGE__->register_method ({
|
|||||||
|
|
||||||
my $usercfg = $rpcenv->{user_cfg};
|
my $usercfg = $rpcenv->{user_cfg};
|
||||||
|
|
||||||
foreach my $poolpath (keys %{$usercfg->{pools}}) {
|
foreach my $pool (keys %{$usercfg->{pools}}) {
|
||||||
my $entry = &$extract_pool_data($usercfg->{pools}->{$poolpath});
|
my $entry = { poolid => $pool };
|
||||||
$entry->{poolid} = $poolpath;
|
my $data = $usercfg->{pools}->{$pool};
|
||||||
|
$entry->{comment} = $data->{comment} if defined($data->{comment});
|
||||||
push @$res, $entry;
|
push @$res, $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user