View | Details | Raw Unified | Return to bug 22417
Collapse All | Expand All

(-)a/admin/background_jobs.pl (-9 / +20 lines)
Lines 31-58 my $input = new CGI; Link Here
31
my $op                = $input->param('op') || 'list';
31
my $op                = $input->param('op') || 'list';
32
my @messages;
32
my @messages;
33
33
34
# The "view" view should be accessible for the user who create this job.
35
my $flags_required = $op ne 'view' ? { parameters => 'manage_background_jobs' } : undef;
36
34
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
37
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
35
    {
38
    {
36
        template_name   => "admin/background_jobs.tt",
39
        template_name   => "admin/background_jobs.tt",
37
        query           => $input,
40
        query           => $input,
38
        type            => "intranet",
41
        type            => "intranet",
39
        authnotrequired => 0,
42
        authnotrequired => 0,
40
        flagsrequired   => { parameters => 'manage_background_jobs' }, # Maybe the "view" view should be accessible for the user who create this job.
43
        flagsrequired   => $flags_required,
41
                                                                       # But in that case what could the permission to check here? tools => '*' ?
42
        debug           => 1,
44
        debug           => 1,
43
    }
45
    }
44
);
46
);
45
47
46
my $dbh = C4::Context->dbh;
47
48
if ( $op eq 'view' ) {
48
if ( $op eq 'view' ) {
49
    my $id = $input->param('id');
49
    my $id = $input->param('id');
50
    if ( my $job = Koha::BackgroundJobs->find($id) ) {
50
    if ( my $job = Koha::BackgroundJobs->find($id) ) {
51
        $template->param(
51
        if ( $job->borrowernumber ne $loggedinuser
52
            job       => $job,
52
            && !Koha::Patrons->find($loggedinuser)->has_permission( { parameters => 'manage_background_jobs' } ) )
53
        );
53
        {
54
        $template->param( lists => scalar Koha::Virtualshelves->search([{ category => 1, owner => $loggedinuser }, { category => 2 }]) )
54
            push @messages, { code => 'cannot_view_job' };
55
            if $job->type eq 'batch_biblio_record_modification';
55
        }
56
        else {
57
            $template->param( job => $job, );
58
            $template->param(
59
                lists => scalar Koha::Virtualshelves->search(
60
                    [
61
                        { category => 1, owner => $loggedinuser },
62
                        { category => 2 }
63
                    ]
64
                )
65
            ) if $job->type eq 'batch_biblio_record_modification';
66
        }
56
    } else {
67
    } else {
57
        $op = 'list';
68
        $op = 'list';
58
    }
69
    }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt (-3 / +6 lines)
Lines 12-18 Link Here
12
<div id="breadcrumbs">
12
<div id="breadcrumbs">
13
    <a href="/cgi-bin/koha/mainpage.pl">Home</a>
13
    <a href="/cgi-bin/koha/mainpage.pl">Home</a>
14
    &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
14
    &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
15
    &rsaquo; <a href="/cgi-bin/koha/admin/background_jobs.pl">Background jobs</a>
15
    [% IF CAN_user_parameters_manage_background_jobs %]&rsaquo; <a href="/cgi-bin/koha/admin/background_jobs.pl">Background jobs</a>[% END %]
16
</div>
16
</div>
17
17
18
<div class="main container-fluid">
18
<div class="main container-fluid">
Lines 25-30 Link Here
25
        [% SWITCH m.code %]
25
        [% SWITCH m.code %]
26
        [% CASE 'cannot_retrieve_jobs' %]
26
        [% CASE 'cannot_retrieve_jobs' %]
27
            <div><i class="fa fa-exclamation error"></i>Cannot retrieve pending jobs ([% m.error %])</div>
27
            <div><i class="fa fa-exclamation error"></i>Cannot retrieve pending jobs ([% m.error %])</div>
28
        [% CASE 'cannot_view_job' %]
29
            <div><i class="fa fa-exclamation error"></i>Insufficient permission to see this job.</div>
28
        [% CASE %]
30
        [% CASE %]
29
            [% m.code | html %]
31
            [% m.code | html %]
30
        [% END %]
32
        [% END %]
Lines 132-138 Link Here
132
        </ol>
134
        </ol>
133
    </fieldset>
135
    </fieldset>
134
136
135
    <a href="/cgi-bin/koha/admin/background_jobs.pl">Return to the job list</a>
137
    [% IF CAN_user_parameters_manage_background_jobs %]
138
        <a href="/cgi-bin/koha/admin/background_jobs.pl">Return to the job list</a>
139
    [% END %]
136
[% END %]
140
[% END %]
137
141
138
[% IF op == 'list' %]
142
[% IF op == 'list' %]
139
- 

Return to bug 22417