|
Lines 35-58
sub list {
Link Here
|
| 35 |
my $c = shift->openapi->valid_input or return; |
35 |
my $c = shift->openapi->valid_input or return; |
| 36 |
|
36 |
|
| 37 |
return try { |
37 |
return try { |
| 38 |
my $patron = $c->stash('koha.user'); |
38 |
my $background_jobs_set = Koha::BackgroundJobs->new; |
| 39 |
|
39 |
my $background_jobs = $c->objects->search($background_jobs_set); |
| 40 |
my $can_manage_background_jobs = |
|
|
| 41 |
$patron->has_permission( { parameters => 'manage_background_jobs' } ); |
| 42 |
|
| 43 |
my $background_jobs_set = |
| 44 |
$can_manage_background_jobs |
| 45 |
? Koha::BackgroundJobs->new |
| 46 |
: Koha::BackgroundJobs->search( |
| 47 |
{ borrowernumber => $patron->borrowernumber } ); |
| 48 |
|
| 49 |
my $background_jobs = $c->objects->search( $background_jobs_set ); |
| 50 |
return $c->render( status => 200, openapi => $background_jobs ); |
40 |
return $c->render( status => 200, openapi => $background_jobs ); |
| 51 |
} |
41 |
} |
| 52 |
catch { |
42 |
catch { |
| 53 |
$c->unhandled_exception($_); |
43 |
$c->unhandled_exception($_); |
| 54 |
}; |
44 |
}; |
| 55 |
|
|
|
| 56 |
} |
45 |
} |
| 57 |
|
46 |
|
| 58 |
sub get { |
47 |
sub get { |
|
Lines 90-94
sub get {
Link Here
|
| 90 |
}; |
79 |
}; |
| 91 |
} |
80 |
} |
| 92 |
|
81 |
|
| 93 |
|
|
|
| 94 |
1; |
82 |
1; |
| 95 |
- |
|
|