Bug 22417: Let owner of a job see the progress
A owner of a job should be able to see the progress of this job. Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
716f5458b6
commit
7f774d08be
2 changed files with 26 additions and 11 deletions
|
@ -31,28 +31,39 @@ my $input = new CGI;
|
|||
my $op = $input->param('op') || 'list';
|
||||
my @messages;
|
||||
|
||||
# The "view" view should be accessible for the user who create this job.
|
||||
my $flags_required = $op ne 'view' ? { parameters => 'manage_background_jobs' } : undef;
|
||||
|
||||
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
||||
{
|
||||
template_name => "admin/background_jobs.tt",
|
||||
query => $input,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => { parameters => 'manage_background_jobs' }, # Maybe the "view" view should be accessible for the user who create this job.
|
||||
# But in that case what could the permission to check here? tools => '*' ?
|
||||
flagsrequired => $flags_required,
|
||||
debug => 1,
|
||||
}
|
||||
);
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
if ( $op eq 'view' ) {
|
||||
my $id = $input->param('id');
|
||||
if ( my $job = Koha::BackgroundJobs->find($id) ) {
|
||||
$template->param(
|
||||
job => $job,
|
||||
);
|
||||
$template->param( lists => scalar Koha::Virtualshelves->search([{ category => 1, owner => $loggedinuser }, { category => 2 }]) )
|
||||
if $job->type eq 'batch_biblio_record_modification';
|
||||
if ( $job->borrowernumber ne $loggedinuser
|
||||
&& !Koha::Patrons->find($loggedinuser)->has_permission( { parameters => 'manage_background_jobs' } ) )
|
||||
{
|
||||
push @messages, { code => 'cannot_view_job' };
|
||||
}
|
||||
else {
|
||||
$template->param( job => $job, );
|
||||
$template->param(
|
||||
lists => scalar Koha::Virtualshelves->search(
|
||||
[
|
||||
{ category => 1, owner => $loggedinuser },
|
||||
{ category => 2 }
|
||||
]
|
||||
)
|
||||
) if $job->type eq 'batch_biblio_record_modification';
|
||||
}
|
||||
} else {
|
||||
$op = 'list';
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<div id="breadcrumbs">
|
||||
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
|
||||
› <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
|
||||
› <a href="/cgi-bin/koha/admin/background_jobs.pl">Background jobs</a>
|
||||
[% IF CAN_user_parameters_manage_background_jobs %]› <a href="/cgi-bin/koha/admin/background_jobs.pl">Background jobs</a>[% END %]
|
||||
</div>
|
||||
|
||||
<div class="main container-fluid">
|
||||
|
@ -25,6 +25,8 @@
|
|||
[% SWITCH m.code %]
|
||||
[% CASE 'cannot_retrieve_jobs' %]
|
||||
<div><i class="fa fa-exclamation error"></i>Cannot retrieve pending jobs ([% m.error %])</div>
|
||||
[% CASE 'cannot_view_job' %]
|
||||
<div><i class="fa fa-exclamation error"></i>Insufficient permission to see this job.</div>
|
||||
[% CASE %]
|
||||
[% m.code | html %]
|
||||
[% END %]
|
||||
|
@ -132,7 +134,9 @@
|
|||
</ol>
|
||||
</fieldset>
|
||||
|
||||
<a href="/cgi-bin/koha/admin/background_jobs.pl">Return to the job list</a>
|
||||
[% IF CAN_user_parameters_manage_background_jobs %]
|
||||
<a href="/cgi-bin/koha/admin/background_jobs.pl">Return to the job list</a>
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
[% IF op == 'list' %]
|
||||
|
|
Loading…
Reference in a new issue