Bugzilla – Attachment 179494 Details for
Bug 39374
No way to restrict OPAC users from Sending lists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39374: Add feature to block sending of lists from OPAC
Bug-39374-Add-feature-to-block-sending-of-lists-fr.patch (text/plain), 4.61 KB, created by
David Cook
on 2025-03-20 02:06:53 UTC
(
hide
)
Description:
Bug 39374: Add feature to block sending of lists from OPAC
Filename:
MIME Type:
Creator:
David Cook
Created:
2025-03-20 02:06:53 UTC
Size:
4.61 KB
patch
obsolete
>From e57ff91eff21f35e8f808be2ea005cd370760436 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Thu, 20 Mar 2025 01:41:26 +0000 >Subject: [PATCH] Bug 39374: Add feature to block sending of lists from OPAC > >This change adds a system preference OPACDisableSendList which >disables the ability to send lists from the OPAC, and hides the >"Send list" link on the opac-shelves.pl page. > >This is useful in situations where you do not want OPAC users to be >able to generate emails to arbitrary addresses with arbitrary comments. > >Test plan: >0. Apply the patch and koha-plack --restart kohadev >1. Create a public list with at least one record and view it in the OPAC >2. Click "Send list" and note you can fill out boxes for "Email address" >and "Comment" >3. Change syspref OPACDisableSendList to "Don't allow" and click "Send list" >again >4. Note the popup window now says "You do not have permission to send this list." >5. Reload the list web page and notice "Send list" no longer appears on the toolbar >next to "Print list" >--- > .../prog/en/modules/admin/preferences/opac.pref | 7 +++++++ > .../opac-tmpl/bootstrap/en/modules/opac-sendshelfform.tt | 2 +- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 2 +- > opac/opac-sendshelf.pl | 6 ++++++ > 4 files changed, 15 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index ec83b17a01..c3d273b682 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -572,6 +572,13 @@ OPAC: > summary: "in user summary box on OPAC homepage (the system preference 'OPACUserSummary' must be enabled)" > user: "on patron's 'your summary' page" > - ". Note that displayed savings may be inaccurate if checkout history is anonymized." >+ - >+ - pref: OPACDisableSendList >+ default: 0 >+ choices: >+ 1: "Don't allow" >+ 0: Allow >+ - "OPAC users to email lists via a 'Send list' button" > OpenURL: > - > - 'Complete URL of OpenURL resolver (starting with <code>http://</code> or <code>https://</code>):' >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelfform.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelfform.tt >index 0b67a02765..459ced0046 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelfform.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelfform.tt >@@ -25,7 +25,7 @@ > </div> > [% END %] > [% ELSE %] >- [% IF ( invalidlist ) %] >+ [% IF ( invalidlist || Koha.Preference('OPACDisableSendList') ) %] > <div class="alert alert-warning"> > <p>You do not have permission to send this list.</p> > </div> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index 22dcb2a545..a6f76a74f7 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -258,7 +258,7 @@ > </div> > </div> > >- [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] >+ [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( ! Koha.Preference('OPACDisableSendList') ) %] > <span class="sendlist" > ><a href="/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelf.shelfnumber | uri %]" class="btn btn-link send"><i class="fa fa-fw fa-envelope" aria-hidden="true"></i> Send list</a></span > > >diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl >index 6674509c99..7168f9d6b7 100755 >--- a/opac/opac-sendshelf.pl >+++ b/opac/opac-sendshelf.pl >@@ -52,6 +52,12 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > } > ); > >+if ( C4::Context->preference('OPACDisableSendList') ) { >+ output_html_with_http_headers $query, $cookie, $template->output, undef, >+ { force_no_caching => 1 }; >+ exit; >+} >+ > my $shelfid = $query->param('shelfid'); > my $email = $query->param('email'); > my $op = $query->param('op') // q{}; >-- >2.39.5
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 39374
:
179494
|
179495
|
179983
|
179984