]> git.proxmox.com Git - pve-manager.git/commitdiff
api: vzdump: extract config: check for VM.Backup privilege
authorFabian Ebner <f.ebner@proxmox.com>
Wed, 30 Mar 2022 10:24:27 +0000 (12:24 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 1 Apr 2022 07:24:35 +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/API2/VZDump.pm

index 2c0df4c37e127e9883330c6a4846b675c63502e5..a6c4d111f5c61513590343f4208bfdadf9d19351 100644 (file)
@@ -269,6 +269,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']);
+       }
+
        return PVE::Storage::extract_vzdump_config($storage_cfg, $volume);
     }});