check volume access: allow for images/rootdir if user has VM.Config.Disk

Listing guest images should not require Datastore.Allocate in this
case. In preparation for adding disk import to the GUI.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner
2022-03-30 12:24:30 +02:00
committed by Fabian Grünbichler
parent 3e1a618e34
commit 42352a4988

View File

@ -488,6 +488,9 @@ sub check_volume_access {
} elsif ($vtype eq 'backup' && $ownervm) {
$rpcenv->check($user, "/storage/$sid", ['Datastore.AllocateSpace']);
$rpcenv->check($user, "/vms/$ownervm", ['VM.Backup']);
} elsif (($vtype eq 'images' || $vtype eq 'rootdir') && $ownervm) {
$rpcenv->check($user, "/storage/$sid", ['Datastore.Audit']);
$rpcenv->check($user, "/vms/$ownervm", ['VM.Config.Disk']);
} else {
die "missing privileges to access $volid\n";
}