Bug 29178 - Only users with manage_background_jobs can cancel a job
Summary: Only users with manage_background_jobs can cancel a job
Status: RESOLVED DUPLICATE of bug 29020
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 22417 29020
Blocks:
  Show dependency treegraph
 
Reported: 2021-10-05 15:17 UTC by Jonathan Druart
Modified: 2021-10-18 12:59 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***