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

(-)a/installer/data/mysql/atomicupdate/bz11317-add-permission-for-tools-access-file.sql (+1 lines)
Line 0 Link Here
1
INSERT INTO permissions (module_bit, code, description) VALUES (13, 'access_files', 'Access to the files stored on the server');
(-)a/installer/data/mysql/userpermissions.sql (+1 lines)
Lines 59-64 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
59
   (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'),
59
   (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'),
60
   (13, 'upload_general_files', 'Upload any file'),
60
   (13, 'upload_general_files', 'Upload any file'),
61
   (13, 'upload_manage', 'Manage uploaded files'),
61
   (13, 'upload_manage', 'Manage uploaded files'),
62
   (13, 'access_files', 'Access to the files stored on the server'),
62
   (15, 'check_expiration', 'Check the expiration of a serial'),
63
   (15, 'check_expiration', 'Check the expiration of a serial'),
63
   (15, 'claim_serials', 'Claim missing serials'),
64
   (15, 'claim_serials', 'Claim missing serials'),
64
   (15, 'create_subscription', 'Create a new subscription'),
65
   (15, 'create_subscription', 'Create a new subscription'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc (+1 lines)
Lines 103-107 Link Here
103
    [%- CASE 'delete_public_lists' -%]<span>Delete public lists</span>
103
    [%- CASE 'delete_public_lists' -%]<span>Delete public lists</span>
104
    [%- CASE 'upload_general_files' -%]<span>Upload any file</span>
104
    [%- CASE 'upload_general_files' -%]<span>Upload any file</span>
105
    [%- CASE 'upload_manage' -%]<span>Manage uploaded files (<i>Useless without upload_general_files</i>)</span>
105
    [%- CASE 'upload_manage' -%]<span>Manage uploaded files (<i>Useless without upload_general_files</i>)</span>
106
    [%- CASE 'access_files' -%]<span>Access to the files stored on the server</span>
106
    [%- END -%]
107
    [%- END -%]
107
[%- END -%]
108
[%- END -%]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt (-3 / +3 lines)
Lines 22-28 Link Here
22
[% INCLUDE 'header.inc' %]
22
[% INCLUDE 'header.inc' %]
23
[% INCLUDE 'cat-search.inc' %]
23
[% INCLUDE 'cat-search.inc' %]
24
24
25
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> &rsaquo; Report/log files</div>
25
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Report/log files</div>
26
26
27
<div id="doc3" class="yui-t2">
27
<div id="doc3" class="yui-t2">
28
   <div id="bd">
28
   <div id="bd">
Lines 46-52 Link Here
46
            <tbody>
46
            <tbody>
47
                [% FOREACH file IN files_loop %]
47
                [% FOREACH file IN files_loop %]
48
                <tr>
48
                <tr>
49
                    <td><a href="/cgi-bin/koha/reports/report_files.pl?id=[% file.id |url %]">[% file.name %]</a></td>
49
                    <td><a href="/cgi-bin/koha/tools/access_files.pl?id=[% file.id |url %]">[% file.name %]</a></td>
50
                    <td align="right">[% file.size %]</td>
50
                    <td align="right">[% file.size %]</td>
51
                    <td>[% file.date %]</td>
51
                    <td>[% file.date %]</td>
52
                </tr>
52
                </tr>
Lines 61-67 Link Here
61
</div>
61
</div>
62
</div>
62
</div>
63
<div class="yui-b">
63
<div class="yui-b">
64
[% INCLUDE 'reports-menu.inc' %]
64
[% INCLUDE 'tools-menu.inc' %]
65
</div>
65
</div>
66
</div>
66
</div>
67
[% INCLUDE 'intranet-bottom.inc' %]
67
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (-1 / +3 lines)
Lines 109-116 Link Here
109
    <dd>Upload any type of file, manage uploads</dd>
109
    <dd>Upload any type of file, manage uploads</dd>
110
    [% END %]
110
    [% END %]
111
111
112
    <dt><a href="/cgi-bin/koha/reports/report_files.pl">Report/log files </a></dt>
112
    [% IF CAN_user_tools_access_files %]
113
    <dt><a href="/cgi-bin/koha/tools/access_files.pl">Report/log files</a></dt>
113
    <dd>Report/log files</dd>
114
    <dd>Report/log files</dd>
115
    [% END %]
114
116
115
</dl>
117
</dl>
116
</div>
118
</div>
(-)a/reports/report_files.pl (-6 / +6 lines)
Lines 4-10 Link Here
4
#
4
#
5
# Show a list of all the files in the directory specified by the option
5
# Show a list of all the files in the directory specified by the option
6
# "accessdir" in koha-conf.xml so they can be downloaded by users with the
6
# "accessdir" in koha-conf.xml so they can be downloaded by users with the
7
# "reports" permission.
7
# "access_files" permission.
8
#
8
#
9
# This file is part of Koha.
9
# This file is part of Koha.
10
#
10
#
Lines 23-34 Link Here
23
23
24
use strict;
24
use strict;
25
use warnings;
25
use warnings;
26
26
use C4::Auth;
27
use C4::Auth;
27
use CGI;
28
use CGI;
28
use C4::Context;
29
use C4::Context;
29
use C4::Output;
30
use C4::Output;
30
use C4::Koha;
31
use C4::Koha;
31
use File::stat;
32
use File::stat qw(stat);
32
use Digest::MD5 qw(md5_hex);
33
use Digest::MD5 qw(md5_hex);
33
34
34
my $input = new CGI;
35
my $input = new CGI;
Lines 37-47 my $accessdir = C4::Context->config('accessdir'); Link Here
37
my @directories = $accessdir ? (ref $accessdir ? @{$accessdir} : ($accessdir)) : ();
38
my @directories = $accessdir ? (ref $accessdir ? @{$accessdir} : ($accessdir)) : ();
38
39
39
my ($template, $borrowernumber, $cookie)
40
my ($template, $borrowernumber, $cookie)
40
    = get_template_and_user({template_name => "reports/report_files.tt",
41
    = get_template_and_user({template_name => "tools/access_files.tt",
41
                query => $input,
42
                query => $input,
42
                type => "intranet",
43
                type => "intranet",
43
                authnotrequired => 0,
44
                authnotrequired => 0,
44
                flagsrequired => {reports => '*'},
45
                flagsrequired => { tools => 'access_files' },
45
                });
46
                });
46
47
47
unless(@directories) {
48
unless(@directories) {
Lines 76-82 else { Link Here
76
77
77
    my %files_hash = map { $_->{id} => $_ } @files_list;
78
    my %files_hash = map { $_->{id} => $_ } @files_list;
78
    # If we received a file_id and it is valid, send the file to the browser
79
    # If we received a file_id and it is valid, send the file to the browser
79
    if(defined $file_id and $file_id >= 0 and exists $files_hash{$file_id} ){
80
    if(defined $file_id and exists $files_hash{$file_id} ){
80
        my $filename = $files_hash{$file_id}->{name};
81
        my $filename = $files_hash{$file_id}->{name};
81
        my $dir = $files_hash{$file_id}->{accessdir};
82
        my $dir = $files_hash{$file_id}->{accessdir};
82
        binmode STDOUT;
83
        binmode STDOUT;
83
- 

Return to bug 11317