Re: [pve-devel] [PATCH manager 2/2] vzdump: move restricted API parameters check

2016-10-12 Thread Dietmar Maurer
applied

___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager 2/2] vzdump: move restricted API parameters check

2016-10-12 Thread Fabian Grünbichler
for better visibility and earlier error detection
---
 PVE/API2/VZDump.pm | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/PVE/API2/VZDump.pm b/PVE/API2/VZDump.pm
index 6a76096..8767aa2 100644
--- a/PVE/API2/VZDump.pm
+++ b/PVE/API2/VZDump.pm
@@ -56,6 +56,11 @@ __PACKAGE__->register_method ({
if $param->{stdout};
}
 
+   foreach my $key (qw(maxfiles tmpdir dumpdir script bwlimit ionice)) {
+   raise_param_exc({ $key => "Only root may set this option."})
+   if defined($param->{$key}) && ($user ne 'root@pam');
+   }
+
# by default we set --rsyncable for gzip
local $ENV{GZIP} = "--rsyncable" if !$ENV{GZIP};
 
@@ -112,11 +117,6 @@ __PACKAGE__->register_method ({
die "you can only backup a single VM with option --stdout\n"
if $param->{stdout} && scalar(@vmids) != 1;
 
-   foreach my $key (qw(maxfiles tmpdir dumpdir script bwlimit ionice)) {
-   raise_param_exc({ $key => "Only root may set this option."})
-   if defined($param->{$key}) && ($user ne 'root@pam');
-   }
-
$rpcenv->check($user, "/storage/$param->{storage}", [ 
'Datastore.AllocateSpace' ])
if $param->{storage};
 
-- 
2.1.4


___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel