Bugzilla – Attachment 136708 Details for
Bug 30982
Use the REST API for background job list view
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30982: Try allow-owner
Bug-30982-Try-allow-owner.patch (text/plain), 2.54 KB, created by
Jonathan Druart
on 2022-06-29 09:41:06 UTC
(
hide
)
Description:
Bug 30982: Try allow-owner
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-06-29 09:41:06 UTC
Size:
2.54 KB
patch
obsolete
>From 969473a1a9b72ec9a2d6b8dc651b730e2aed49b3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 29 Jun 2022 11:40:41 +0200 >Subject: [PATCH] Bug 30982: Try allow-owner > >--- > Koha/REST/V1/BackgroundJobs.pm | 17 +---------------- > api/v1/swagger/paths/background_jobs.yaml | 2 ++ > 2 files changed, 3 insertions(+), 16 deletions(-) > >diff --git a/Koha/REST/V1/BackgroundJobs.pm b/Koha/REST/V1/BackgroundJobs.pm >index 55f121b403b..cc4c2efcaff 100644 >--- a/Koha/REST/V1/BackgroundJobs.pm >+++ b/Koha/REST/V1/BackgroundJobs.pm >@@ -40,11 +40,7 @@ sub list { > my $can_manage_background_jobs = > $patron->has_permission( { parameters => 'manage_background_jobs' } ); > >- my $background_jobs_set = >- $can_manage_background_jobs >- ? Koha::BackgroundJobs->new >- : Koha::BackgroundJobs->search( >- { borrowernumber => $patron->borrowernumber } ); >+ my $background_jobs_set = Koha::BackgroundJobs->search; > > my $background_jobs = $c->objects->search( $background_jobs_set ); > return $c->render( status => 200, openapi => $background_jobs ); >@@ -61,10 +57,6 @@ sub get { > return try { > > my $background_job_id = $c->validation->param('background_job_id'); >- my $patron = $c->stash('koha.user'); >- >- my $can_manage_background_jobs = >- $patron->has_permission( { parameters => 'manage_background_jobs' } ); > > my $background_job = Koha::BackgroundJobs->find($background_job_id); > >@@ -73,13 +65,6 @@ sub get { > openapi => { error => "Object not found" } > ) unless $background_job; > >- return $c->render( >- status => 403, >- openapi => { error => "Cannot see background job info" } >- ) >- if !$can_manage_background_jobs >- && $background_job->borrowernumber != $patron->borrowernumber; >- > return $c->render( > status => 200, > openapi => $background_job->to_api >diff --git a/api/v1/swagger/paths/background_jobs.yaml b/api/v1/swagger/paths/background_jobs.yaml >index c386dfc5c5c..389d56ece97 100644 >--- a/api/v1/swagger/paths/background_jobs.yaml >+++ b/api/v1/swagger/paths/background_jobs.yaml >@@ -87,6 +87,7 @@ > x-koha-authorization: > permissions: > catalogue: "1" >+ allow-owner: true > "/background_jobs/{background_job_id}": > get: > x-mojo-to: BackgroundJobs#get >@@ -125,3 +126,4 @@ > x-koha-authorization: > permissions: > catalogue: "1" >+ allow-owner: true >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30982
:
136245
|
136246
|
136670
|
136671
|
136672
|
136707
|
136708
|
136715
|
138114
|
139636
|
139637
|
139638
|
139639
|
139640
|
139641
|
140488
|
140489
|
140490
|
140491
|
140492
|
140493
|
140494
|
140495
|
140496
|
140497
|
140498
|
140589
|
140590
|
140591
|
140592
|
140593
|
140594
|
140595
|
140596
|
140597
|
140598
|
140599
|
140789
|
140884
|
140885
|
140886
|
140887
|
140888
|
140889
|
140890
|
140891
|
140892
|
140893
|
140894
|
140895
|
140896
|
140897
|
142859