X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=Koha%2FBackgroundJobs.pm;h=48afbf68fa8a26a8e3159a365f41f7650dc1dc02;hb=2d25c2860c4b06a63048834fb99b2968f1fd57b1;hp=1d0506a0e7b3a01b65805f4da971cb7a694b76b3;hpb=c6b2724c2f20c5c86823eb126d52ea252160e850;p=koha-ffzg.git diff --git a/Koha/BackgroundJobs.pm b/Koha/BackgroundJobs.pm index 1d0506a0e7..48afbf68fa 100644 --- a/Koha/BackgroundJobs.pm +++ b/Koha/BackgroundJobs.pm @@ -40,9 +40,7 @@ Returns all background jobs the logged in user should be allowed to see sub search_limited { my ( $self, $params, $attributes ) = @_; - # Assume permission if context has no user - my $can_manage_background_jobs = 1; - + my $can_manage_background_jobs; my $logged_in_user; my $userenv = C4::Context->userenv; if ( $userenv and $userenv->{number} ) { @@ -51,10 +49,9 @@ sub search_limited { { parameters => 'manage_background_jobs' } ); } - return $can_manage_background_jobs - ? $self->search( $params, $attributes ) - : $self->search( { borrowernumber => $logged_in_user->borrowernumber } ) - ->search( $params, $attributes ); + return $self->search( $params, $attributes ) if $can_manage_background_jobs; + my $id = $logged_in_user ? $logged_in_user->borrowernumber : undef; + return $self->search({ borrowernumber => $id })->search( $params, $attributes ); } =head3 filter_by_current