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 57-62 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
57
   (13, 'records_batchmod', 'Perform batch modification of records (biblios or authorities)'),
57
   (13, 'records_batchmod', 'Perform batch modification of records (biblios or authorities)'),
58
   (13, 'marc_modification_templates', 'Manage marc modification templates'),
58
   (13, 'marc_modification_templates', 'Manage marc modification templates'),
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, 'access_files', 'Access to the files stored on the server'),
60
   (13, 'upload_general_files', 'Upload any file'),
61
   (13, 'upload_general_files', 'Upload any file'),
61
   (13, 'upload_manage', 'Manage uploaded files'),
62
   (13, 'upload_manage', 'Manage uploaded files'),
62
   (15, 'check_expiration', 'Check the expiration of a serial'),
63
   (15, 'check_expiration', 'Check the expiration of a serial'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc (+1 lines)
Lines 104-109 Link Here
104
    [%- CASE 'delete_public_lists' -%]<span>Delete public lists</span>
104
    [%- CASE 'delete_public_lists' -%]<span>Delete public lists</span>
105
    [%- CASE 'upload_general_files' -%]<span>Upload any file</span>
105
    [%- CASE 'upload_general_files' -%]<span>Upload any file</span>
106
    [%- CASE 'upload_manage' -%]<span>Manage uploaded files (<i>Useless without upload_general_files</i>)</span>
106
    [%- CASE 'upload_manage' -%]<span>Manage uploaded files (<i>Useless without upload_general_files</i>)</span>
107
    [%- CASE 'access_files' -%]<span>Access to the files stored on the server</span>
107
    [%- CASE 'edit_clubs' -%]<span>Create and edit clubs</span>
108
    [%- CASE 'edit_clubs' -%]<span>Create and edit clubs</span>
108
    [%- CASE 'edit_templates' -%]<span>Create and edit club templates</span>
109
    [%- CASE 'edit_templates' -%]<span>Create and edit club templates</span>
109
    [%- CASE 'enroll' -%]<span>Enroll patrons in clubs</span>
110
    [%- CASE 'enroll' -%]<span>Enroll patrons in clubs</span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt (-5 / +4 lines)
Lines 3-16 Link Here
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
5
[% INCLUDE 'datatables.inc' %]
5
[% INCLUDE 'datatables.inc' %]
6
[% INCLUDE 'datatables-strings.inc' %]
7
<script type="text/JavaScript" language="JavaScript">
6
<script type="text/JavaScript" language="JavaScript">
8
    //<![CDATA[
7
    //<![CDATA[
9
        $(document).ready(function() {
8
        $(document).ready(function() {
10
            $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
9
            $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
11
                "sDom": 't',
10
                "sDom": 't',
12
                "aoColumnDefs": [
11
                "aoColumnDefs": [
13
                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }
12
                    { "aTargets": [ -1 ], "asSorting" : [ "desc", "asc" ], "bSearchable": false }
14
                ],
13
                ],
15
                "bPaginate": false
14
                "bPaginate": false
16
            }));
15
            }));
Lines 22-28 Link Here
22
[% INCLUDE 'header.inc' %]
21
[% INCLUDE 'header.inc' %]
23
[% INCLUDE 'cat-search.inc' %]
22
[% INCLUDE 'cat-search.inc' %]
24
23
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>
24
<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
25
27
<div id="doc3" class="yui-t2">
26
<div id="doc3" class="yui-t2">
28
   <div id="bd">
27
   <div id="bd">
Lines 46-52 Link Here
46
            <tbody>
45
            <tbody>
47
                [% FOREACH file IN files_loop %]
46
                [% FOREACH file IN files_loop %]
48
                <tr>
47
                <tr>
49
                    <td><a href="/cgi-bin/koha/reports/report_files.pl?id=[% file.id |url %]">[% file.name %]</a></td>
48
                    <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>
49
                    <td align="right">[% file.size %]</td>
51
                    <td>[% file.date %]</td>
50
                    <td>[% file.date %]</td>
52
                </tr>
51
                </tr>
Lines 61-67 Link Here
61
</div>
60
</div>
62
</div>
61
</div>
63
<div class="yui-b">
62
<div class="yui-b">
64
[% INCLUDE 'reports-menu.inc' %]
63
[% INCLUDE 'tools-menu.inc' %]
65
</div>
64
</div>
66
</div>
65
</div>
67
[% INCLUDE 'intranet-bottom.inc' %]
66
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (-1 / +3 lines)
Lines 114-121 Link Here
114
    <dd>Upload any type of file, manage uploads</dd>
114
    <dd>Upload any type of file, manage uploads</dd>
115
    [% END %]
115
    [% END %]
116
116
117
    <dt><a href="/cgi-bin/koha/reports/report_files.pl">Report/log files </a></dt>
117
    [% IF CAN_user_tools_access_files %]
118
    <dt><a href="/cgi-bin/koha/tools/access_files.pl">Report/log files</a></dt>
118
    <dd>Report/log files</dd>
119
    <dd>Report/log files</dd>
120
    [% END %]
119
121
120
</dl>
122
</dl>
121
</div>
123
</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