]> git.proxmox.com Git - pve-access-control.git/commitdiff
api: realm sync: code cleanups
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 7 Jun 2023 07:32:26 +0000 (09:32 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 7 Jun 2023 07:32:59 +0000 (09:32 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/API2/AccessControl/RealmSync.pm

index 526a2277f1e4f4eb3f08095cb84b913e0903b1c8..f5334b8bdb68e51c8e55a7e072fbae06c3f2f994 100644 (file)
@@ -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/<realm>' and "
-           ." 'User.Modify' permissions to '/access/groups/'.",
+       description => "'Realm.AllocateUser' on '/access/realm/<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');