Bugzilla – Attachment 65913 Details for
Bug 11317
Add a way to access files from the intranet
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11317 - Move file access under Tools and add specific permission
Bug-11317---Move-file-access-under-Tools-and-add-s.patch (text/plain), 8.49 KB, created by
Philippe Audet-Fortin
on 2017-08-11 15:40:02 UTC
(
hide
)
Description:
Bug 11317 - Move file access under Tools and add specific permission
Filename:
MIME Type:
Creator:
Philippe Audet-Fortin
Created:
2017-08-11 15:40:02 UTC
Size:
8.49 KB
patch
obsolete
>From 0c2288640cbf69f458490fe0d6350190db5ca926 Mon Sep 17 00:00:00 2001 >From: Blou <philippe.blouin@inlibro.com> >Date: Tue, 19 Apr 2016 11:20:00 -0400 >Subject: [PATCH] Bug 11317 - Move file access under Tools and add specific > permission > >- Moves the .pl and .tt under tools/ instead of reports/ and adds tools/access_files permission. >- Remove datatables-strings.inc from .tt >- Allow sorting on date column in file access tool. For some reason, the table was blocking sorting based on timestamp, > even though most users would probably want that since the feature is used primarily to access generated (daily) reports i > and finding the last ones is very important. > >Testing >-1) Having done requirements of previous patches, like adding 'accessdir' to koha-conf... >0) apply patch, update database to add permission option. >1) Login as NON-superadmin. Go under tools, see no Report/Log under the third column >2) Go to add tools/access_file permission to user >3) See new entry under tools third column. >4) validate link is ok. >--- > .../bz11317-add-permission-for-tools-access-file.sql | 1 + > installer/data/mysql/userpermissions.sql | 1 + > koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc | 1 + > .../{reports/report_files.tt => tools/access_files.tt} | 9 ++++----- > koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt | 4 +++- > reports/report_files.pl => tools/access_files.pl | 11 ++++++----- > 6 files changed, 16 insertions(+), 11 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bz11317-add-permission-for-tools-access-file.sql > rename koha-tmpl/intranet-tmpl/prog/en/modules/{reports/report_files.tt => tools/access_files.tt} (82%) > rename reports/report_files.pl => tools/access_files.pl (93%) > >diff --git a/installer/data/mysql/atomicupdate/bz11317-add-permission-for-tools-access-file.sql b/installer/data/mysql/atomicupdate/bz11317-add-permission-for-tools-access-file.sql >new file mode 100644 >index 0000000..dc49a78 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bz11317-add-permission-for-tools-access-file.sql >@@ -0,0 +1 @@ >+INSERT INTO permissions (module_bit, code, description) VALUES (13, 'access_files', 'Access to the files stored on the server'); >diff --git a/installer/data/mysql/userpermissions.sql b/installer/data/mysql/userpermissions.sql >index 172f4c6..90fe6c0 100644 >--- a/installer/data/mysql/userpermissions.sql >+++ b/installer/data/mysql/userpermissions.sql >@@ -57,6 +57,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > (13, 'records_batchmod', 'Perform batch modification of records (biblios or authorities)'), > (13, 'marc_modification_templates', 'Manage marc modification templates'), > (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'), >+ (13, 'access_files', 'Access to the files stored on the server'), > (13, 'upload_general_files', 'Upload any file'), > (13, 'upload_manage', 'Manage uploaded files'), > (15, 'check_expiration', 'Check the expiration of a serial'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >index 7c6275a..3145938 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >@@ -104,6 +104,7 @@ > [%- CASE 'delete_public_lists' -%]<span>Delete public lists</span> > [%- CASE 'upload_general_files' -%]<span>Upload any file</span> > [%- CASE 'upload_manage' -%]<span>Manage uploaded files (<i>Useless without upload_general_files</i>)</span> >+ [%- CASE 'access_files' -%]<span>Access to the files stored on the server</span> > [%- CASE 'edit_clubs' -%]<span>Create and edit clubs</span> > [%- CASE 'edit_templates' -%]<span>Create and edit club templates</span> > [%- CASE 'enroll' -%]<span>Enroll patrons in clubs</span> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/access_files.tt >similarity index 82% >rename from koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt >rename to koha-tmpl/intranet-tmpl/prog/en/modules/tools/access_files.tt >index 06de9d1..1f8a394 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/access_files.tt >@@ -3,14 +3,13 @@ > [% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> > [% INCLUDE 'datatables.inc' %] >-[% INCLUDE 'datatables-strings.inc' %] > <script type="text/JavaScript" language="JavaScript"> > //<![CDATA[ > $(document).ready(function() { > $("#files").dataTable($.extend(true, {}, dataTablesDefaults, { > "sDom": 't', > "aoColumnDefs": [ >- { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false } >+ { "aTargets": [ -1 ], "asSorting" : [ "desc", "asc" ], "bSearchable": false } > ], > "bPaginate": false > })); >@@ -22,7 +21,7 @@ > [% INCLUDE 'header.inc' %] > [% INCLUDE 'cat-search.inc' %] > >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> › Report/log files</div> >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › Report/log files</div> > > <div id="doc3" class="yui-t2"> > <div id="bd"> >@@ -46,7 +45,7 @@ > <tbody> > [% FOREACH file IN files_loop %] > <tr> >- <td><a href="/cgi-bin/koha/reports/report_files.pl?id=[% file.id |url %]">[% file.name %]</a></td> >+ <td><a href="/cgi-bin/koha/tools/access_files.pl?id=[% file.id |url %]">[% file.name %]</a></td> > <td align="right">[% file.size %]</td> > <td>[% file.date %]</td> > </tr> >@@ -61,7 +60,7 @@ > </div> > </div> > <div class="yui-b"> >-[% INCLUDE 'reports-menu.inc' %] >+[% INCLUDE 'tools-menu.inc' %] > </div> > </div> > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >index 60a4e85..6aa69ed 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >@@ -114,8 +114,10 @@ > <dd>Upload any type of file, manage uploads</dd> > [% END %] > >- <dt><a href="/cgi-bin/koha/reports/report_files.pl">Report/log files </a></dt> >+ [% IF CAN_user_tools_access_files %] >+ <dt><a href="/cgi-bin/koha/tools/access_files.pl">Report/log files</a></dt> > <dd>Report/log files</dd> >+ [% END %] > > </dl> > </div> >diff --git a/reports/report_files.pl b/tools/access_files.pl >similarity index 93% >rename from reports/report_files.pl >rename to tools/access_files.pl >index aea95a0..a0b8bef 100755 >--- a/reports/report_files.pl >+++ b/tools/access_files.pl >@@ -4,7 +4,7 @@ > # > # Show a list of all the files in the directory specified by the option > # "accessdir" in koha-conf.xml so they can be downloaded by users with the >-# "reports" permission. >+# "access_files" permission. > # > # This file is part of Koha. > # >@@ -23,12 +23,13 @@ > > use strict; > use warnings; >+ > use C4::Auth; > use CGI; > use C4::Context; > use C4::Output; > use C4::Koha; >-use File::stat; >+use File::stat qw(stat); > use Digest::MD5 qw(md5_hex); > > my $input = new CGI; >@@ -37,11 +38,11 @@ my $accessdir = C4::Context->config('accessdir'); > my @directories = $accessdir ? (ref $accessdir ? @{$accessdir} : ($accessdir)) : (); > > my ($template, $borrowernumber, $cookie) >- = get_template_and_user({template_name => "reports/report_files.tt", >+ = get_template_and_user({template_name => "tools/access_files.tt", > query => $input, > type => "intranet", > authnotrequired => 0, >- flagsrequired => {reports => '*'}, >+ flagsrequired => { tools => 'access_files' }, > }); > > unless(@directories) { >@@ -76,7 +77,7 @@ else { > > my %files_hash = map { $_->{id} => $_ } @files_list; > # If we received a file_id and it is valid, send the file to the browser >- if(defined $file_id and $file_id >= 0 and exists $files_hash{$file_id} ){ >+ if(defined $file_id and exists $files_hash{$file_id} ){ > my $filename = $files_hash{$file_id}->{name}; > my $dir = $files_hash{$file_id}->{accessdir}; > binmode STDOUT; >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11317
:
23203
|
25387
|
27492
|
27579
|
27604
|
35938
|
35939
|
35940
|
36844
|
39783
|
39784
|
39785
|
39786
|
44859
|
44860
|
48629
|
48635
|
49941
|
49942
|
49943
|
49944
|
49945
|
49946
|
49947
|
50421
|
50424
|
50425
|
50440
|
53446
|
58220
|
58221
|
58222
|
58223
|
58224
|
58225
|
58226
|
62971
|
62972
|
62973
|
62974
|
62975
|
64088
|
64089
|
65691
|
65851
|
65855
|
65856
|
65857
|
65909
|
65910
|
65911
|
65912
|
65913
|
65914
|
65915
|
65918
|
66091
|
66092
|
66093
|
66094
|
66095
|
66096
|
66097
|
66098
|
66099
|
66100
|
72097
|
72309
|
72456
|
72457
|
72458
|
72459
|
72460
|
72461
|
72462
|
72463
|
72464
|
72465
|
74119
|
74379
|
74756
|
74911
|
74912
|
74916
|
74917
|
74918
|
74919
|
75019