[pve-devel] [PATCH manager 1/4] api: backup: refactor backup permission check
Alexander Zeidler
a.zeidler at proxmox.com
Tue Jun 13 15:42:51 CEST 2023
Unify style before adding another parameter check
Signed-off-by: Alexander Zeidler <a.zeidler at proxmox.com>
---
PVE/API2/Backup.pm | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/PVE/API2/Backup.pm b/PVE/API2/Backup.pm
index 45eb47e2..cae889f4 100644
--- a/PVE/API2/Backup.pm
+++ b/PVE/API2/Backup.pm
@@ -49,8 +49,11 @@ sub assert_param_permission_common {
raise_param_exc({ $key => "Only root may set this option."}) if exists $param->{$key};
}
- if (defined($param->{bwlimit}) || defined($param->{ionice}) || defined($param->{performance})) {
- $rpcenv->check($user, "/", [ 'Sys.Modify' ]);
+ for my $key (qw(bwlimit ionice performance)) {
+ if (defined($param->{$key})) {
+ $rpcenv->check($user, "/", [ 'Sys.Modify' ]);
+ last;
+ }
}
}
--
2.39.2
More information about the pve-devel
mailing list