]> git.proxmox.com Git - pve-storage.git/commitdiff
pvesm: extract config: check for VM.Backup privilege
authorFabian Ebner <f.ebner@proxmox.com>
Wed, 30 Mar 2022 10:24:28 +0000 (12:24 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 1 Apr 2022 07:24:16 +0000 (09:24 +0200)
In preparation to have check_volume_access() always allow access for
users with Datastore.Allocate privilege. As to not automatically give
all such users permission to extract the config too.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/CLI/pvesm.pm

index 190de914ccd1f049ed76445fd20ff257da3a1026..1daed71a1978c528e8c642e81a5608e53947b157 100755 (executable)
@@ -172,6 +172,11 @@ __PACKAGE__->register_method ({
        my $storage_cfg = PVE::Storage::config();
        PVE::Storage::check_volume_access($rpcenv, $authuser, $storage_cfg, undef, $volume);
 
+       if (PVE::Storage::parse_volume_id($volume, 1)) {
+           my (undef, undef, $ownervm) = PVE::Storage::parse_volname($storage_cfg, $volume);
+           $rpcenv->check($authuser, "/vms/$ownervm", ['VM.Backup']);
+       }
+
        my $config_raw = PVE::Storage::extract_vzdump_config($storage_cfg, $volume);
 
        print "$config_raw\n";