From: Thomas Lamprecht Date: Wed, 7 Jun 2023 07:32:26 +0000 (+0200) Subject: api: realm sync: code cleanups X-Git-Url: https://git.proxmox.com/?p=pve-access-control.git;a=commitdiff_plain;h=c0210e3cf1d2a7b6dae3a069b6ba4f8daead9215 api: realm sync: code cleanups Signed-off-by: Thomas Lamprecht --- diff --git a/src/PVE/API2/AccessControl/RealmSync.pm b/src/PVE/API2/AccessControl/RealmSync.pm index 526a227..f5334b8 100644 --- a/src/PVE/API2/AccessControl/RealmSync.pm +++ b/src/PVE/API2/AccessControl/RealmSync.pm @@ -102,6 +102,7 @@ __PACKAGE__->register_method ({ if (my $schedule = $job->{schedule}) { $job->{'last-run'} = eval { $get_cluster_last_run->($jobid) }; my $last_run = $job->{'last-run'} // time(); # current time as fallback + my $calendar_event = Proxmox::RS::CalendarEvent->new($schedule); my $next_run = $calendar_event->compute_next_event($last_run); $job->{'next-run'} = $next_run if defined($next_run); @@ -201,8 +202,8 @@ __PACKAGE__->register_method({ protected => 1, description => "Update realm-sync job definition.", permissions => { - description => "'Realm.AllocateUser' on '/access/realm/' and " - ." 'User.Modify' permissions to '/access/groups/'.", + description => "'Realm.AllocateUser' on '/access/realm/' and 'User.Modify'" + ." permissions to '/access/groups/'.", check => [ 'and', ['perm', '/access/realm/{realm}', ['Realm.AllocateUser']], ['perm', '/access/groups', ['User.Modify']], @@ -215,9 +216,7 @@ __PACKAGE__->register_method({ my $id = extract_param($param, 'id'); my $delete = extract_param($param, 'delete'); - if ($delete) { - $delete = [PVE::Tools::split_list($delete)]; - } + $delete = [PVE::Tools::split_list($delete)] if $delete; cfs_lock_file('jobs.cfg', undef, sub { my $jobs = cfs_read_file('jobs.cfg');