Bug 29178

Summary: Only users with manage_background_jobs can cancel a job
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: fridolin.somers
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 22417, 29020    
Bug Blocks:    

Description Jonathan Druart 2021-10-05 15:17:29 UTC
64     if ( my $job = Koha::BackgroundJobs->find($id) ) { # FIXME Make sure logged in user can cancel this job
 65         $job->cancel;
 66     }

This FIXME must be fixed ASAP.
Comment 1 Fridolin Somers 2021-10-05 20:32:00 UTC
You mean adding :
  if ( $job->borrowernumber eq $loggedinuser )

But we could argue that any staff user with 'manage_background_jobs' permission should be able to cancel a job, no ?
Comment 2 Jonathan Druart 2021-10-06 08:05:27 UTC
(In reply to Fridolin Somers from comment #1)
> You mean adding :
>   if ( $job->borrowernumber eq $loggedinuser )
> 
> But we could argue that any staff user with 'manage_background_jobs'
> permission should be able to cancel a job, no ?

Users with manage_background_jobs are the only ones who can cancel jobs. The idea here is to make it possible for the user who enqueued the job.
Comment 3 Fridolin Somers 2021-10-07 21:52:18 UTC
(In reply to Jonathan Druart from comment #2)
> 
> Users with manage_background_jobs are the only ones who can cancel jobs. The
> idea here is to make it possible for the user who enqueued the job.

Ahhh thanks I get it now
Comment 4 Jonathan Druart 2021-10-18 12:59:38 UTC
Will be fixed by bug 29020.

*** This bug has been marked as a duplicate of bug 29020 ***