PVE::Storage: new helper check_volume_access()

Copied from PVE::RPCEnvironment to avoid cyclic dependency
(pve-storgae => pve-access-control => pve-storage).
This commit is contained in:
Dietmar Maurer
2017-01-18 17:14:07 +01:00
parent ef881e10eb
commit 04a13668b9
3 changed files with 29 additions and 3 deletions

View File

@ -72,7 +72,7 @@ __PACKAGE__->register_method ({
my $res = [];
foreach my $item (@$vollist) {
eval { $rpcenv->check_volume_access($authuser, $cfg, undef, $item->{volid}); };
eval { PVE::Storage::check_volume_access($rpcenv, $authuser, $cfg, undef, $item->{volid}); };
next if $@;
push @$res, $item;
}
@ -219,7 +219,7 @@ __PACKAGE__->register_method ({
my $cfg = PVE::Storage::config();
$rpcenv->check_volume_access($authuser, $cfg, undef, $volid);
PVE::Storage::check_volume_access($rpcenv, $rpcenv->$authuser, $cfg, undef, $volid);
my $path = PVE::Storage::path($cfg, $volid);
my ($size, $format, $used, $parent) = PVE::Storage::file_size_info($path);