Bugzilla – Attachment 181336 Details for
Bug 39372
No way to restrict OPAC users from creating private lists specifically
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39372: Limit OPAC list creation
Bug-39372-Limit-OPAC-list-creation.patch (text/plain), 18.38 KB, created by
Marion Durand
on 2025-04-23 07:42:11 UTC
(
hide
)
Description:
Bug 39372: Limit OPAC list creation
Filename:
MIME Type:
Creator:
Marion Durand
Created:
2025-04-23 07:42:11 UTC
Size:
18.38 KB
patch
obsolete
>From c256f528094b20ca15c863dfecab5307b8bfa920 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Thu, 20 Mar 2025 05:18:27 +0000 >Subject: [PATCH] Bug 39372: Limit OPAC list creation > >This change adds a new system preference OpacAllowPrivateListCreation, >which works with the existing system preference OpacAllowPublicListCreation, >to determine when "New list", "Save to lists", "Add to list", "Save to another list", >and "Add to a list" should appear. > >If both sysprefs are disabled, then you cannot do these actions. If one of the sysprefs >is enabled, then these actions appear, but are limited to the private or public list type >respective to the syspref. > >Test plan: >0. Apply the patch and koha-plack --restart kohadev >1. Perform the following steps using differing combinations of OpacAllowPrivateListCreation, >or OpacAllowPublicListCreation, or both disabled >2. Click on Lists in masthead nav and note presence of "New list" link >3. Perform a search >4. Note the presence of "Save to lists" and "Add to list" links >5. Go to a record detail page >6. Note the presence of "Save to your lists" on the sidebar >7. Create a list >8. Go to the list >9. Note the presence of "Save to another list" and "New list" links >10. Add a record to the cart >11. Note the presence of "Add to a list" link > >Signed-off-by: Marion Durand <marion.durand@biblibre.com> >--- > .../en/modules/admin/preferences/opac.pref | 7 +++ > .../bootstrap/en/includes/masthead.inc | 6 +- > .../en/includes/opac-detail-sidebar.inc | 2 +- > .../en/includes/result-batch-controls.inc | 8 ++- > .../en/includes/title-actions-menu.inc | 2 +- > .../en/modules/opac-addbybiblionumber.tt | 57 +++++++++++-------- > .../bootstrap/en/modules/opac-basket.tt | 4 +- > .../bootstrap/en/modules/opac-shelves.tt | 16 ++++-- > 8 files changed, 63 insertions(+), 39 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..e48f695cef 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 >@@ -651,6 +651,13 @@ OPAC: > 0: "Don't hide" > 1: Hide > - "the bibliographic record when all its items are hidden by <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems'>OpacHiddenItems</a>." >+ - >+ - pref: OpacAllowPrivateListCreation >+ default: 1 >+ choices: >+ 0: "Don't allow" >+ 1: Allow >+ - "OPAC users to create private lists." > - > - pref: OpacAllowPublicListCreation > default: 1 >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index 9eb4e7b5d1..5729d6b2b3 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -98,8 +98,10 @@ > [% ELSE %] > <a class="dropdown-item disabled" aria-disabled="true" href="#" tabindex="-1" role="menuitem">No private lists</a> > [% END %] >- <a class="dropdown-item listmenulink" href="/cgi-bin/koha/opac-shelves.pl?op=add_form" tabindex="-1" role="menuitem">New list</a> >- [% ELSE %] >+ [% IF ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) %] >+ <a class="dropdown-item listmenulink" href="/cgi-bin/koha/opac-shelves.pl?op=add_form" tabindex="-1" role="menuitem">New list</a> >+ [% END %] >+ [% ELSIF ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) %] > <a class="dropdown-item" href="/cgi-bin/koha/opac-shelves.pl?op=add_form" tabindex="-1" role="menuitem">Log in to create your own lists</a> > [% END # / IF loggedinusername %] > [% END # / IF opacuserlogin %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >index 03e74f148c..74f39e80c6 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >@@ -35,7 +35,7 @@ > [% END %] > > [% IF Koha.Preference( 'virtualshelves' ) == 1 %] >- [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && loggedinusername ) %] >+ [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && loggedinusername && ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) ) %] > <li > ><a class="addtoshelf btn btn-link btn-lg" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% biblio.biblionumber | html %]"><i class="fa fa-fw fa-list" aria-hidden="true"></i> Save to your lists</a></li > > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/result-batch-controls.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/result-batch-controls.inc >index 1a9e80aa62..da58793675 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/result-batch-controls.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/result-batch-controls.inc >@@ -29,9 +29,11 @@ > > [% IF ( ListsEnabled ) %] > <div class="btn-group"> >- <button type="button" class="btn btn-link btn-xs dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> >- <i class="fa fa-list" aria-hidden="true"></i> Add to list <span class="caret"></span> >- </button> >+ [% IF ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) %] >+ <button type="button" class="btn btn-link btn-xs dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> >+ <i class="fa fa-list" aria-hidden="true"></i> Add to list <span class="caret"></span> >+ </button> >+ [% END %] > <div class="dropdown-menu"> > [% IF add_to_some_private_shelves.count %] > <h6 class="dropdown-header">Your lists</h6> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc >index cffc84910f..c5492f41c2 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc >@@ -62,7 +62,7 @@ > [% END # IF loggedinusername %] > [% END # if TagsInputEnabled %] > >- [% IF ( ListsEnabled ) %] >+ [% IF ( ListsEnabled ) && ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) %] > [% IF ( shelf AND op == 'view' ) %] > <span class="actions" > ><a href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% items.biblionumber | uri %]" class="addtoshelf btn btn-link btn-sm"><i class="fa fa-fw fa-list" aria-hidden="true"></i> Save to another list</a></span >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-addbybiblionumber.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-addbybiblionumber.tt >index bce9384a2d..25dd40076b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-addbybiblionumber.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-addbybiblionumber.tt >@@ -1,3 +1,4 @@ >+[% USE Koha %] > [% USE raw %] > [% PROCESS 'i18n.inc' %] > [% PROCESS 'html_helpers.inc' %] >@@ -72,7 +73,9 @@ > <a class="close cancel" href="#">Cancel</a> > </fieldset> > </form> >- <p>...or...</p> >+ [% IF ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) %] >+ <p>...or...</p> >+ [% END %] > [% ELSE %] > [% IF ( singleshelf ) %] > <form name="f1" action="/cgi-bin/koha/opac-addbybiblionumber.pl" method="post"> >@@ -92,30 +95,34 @@ > [% END # / UNLESS newshelf %] > > [% UNLESS ( singleshelf ) %] >- <form name="f2" method="post" action="/cgi-bin/koha/opac-addbybiblionumber.pl"> >- [% INCLUDE 'csrf-token.inc' %] >- <fieldset> >- <legend>Add to a new list:</legend> >- <label for="newvirtualshelf">List name:</label> >- <input type="text" name="newvirtualshelf" id="newvirtualshelf" size="40" /> >- <label for="category">Category:</label> >- <select name="public" id="public"> >- <option value="0">Private</option> >- [% IF (OpacAllowPublicListCreation) %] >- <option value="1">Public</option> >- [% END %] >- </select> >- </fieldset> >- [% FOREACH biblio IN biblios %] >- <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html %]" /> >- [% END %] >- <fieldset class="action"> >- <input type="hidden" name="op" value="cud-add" /> >- <input type="hidden" name="sortfield" value="title" /> >- <input type="submit" value="Save" class="btn btn-primary" /> >- <a class="close cancel" href="#">Cancel</a> >- </fieldset> >- </form> >+ [% IF ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) %] >+ <form name="f2" method="post" action="/cgi-bin/koha/opac-addbybiblionumber.pl"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <fieldset> >+ <legend>Add to a new list:</legend> >+ <label for="newvirtualshelf">List name:</label> >+ <input type="text" name="newvirtualshelf" id="newvirtualshelf" size="40" /> >+ <label for="category">Category:</label> >+ <select name="public" id="public"> >+ [% IF Koha.Preference('OpacAllowPrivateListCreation') %] >+ <option value="0">Private</option> >+ [% END %] >+ [% IF (OpacAllowPublicListCreation) %] >+ <option value="1">Public</option> >+ [% END %] >+ </select> >+ </fieldset> >+ [% FOREACH biblio IN biblios %] >+ <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html %]" /> >+ [% END %] >+ <fieldset class="action"> >+ <input type="hidden" name="op" value="cud-add" /> >+ <input type="hidden" name="sortfield" value="title" /> >+ <input type="submit" value="Save" class="btn btn-primary" /> >+ <a class="close cancel" href="#">Cancel</a> >+ </fieldset> >+ </form> >+ [% END %] > [% END # / UNLESS singleshelf %] > [% ELSE %] > <p> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt >index 0576f0a61c..1a06f32537 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt >@@ -80,8 +80,8 @@ > <span class="selections">Select titles to: </span> > <a href="#" class="btn btn-link btn-sm remove deleteshelf disabled" aria-disabled="true"><i class="fa fa-times" aria-hidden="true"></i> Remove</a> > [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) %] >- [% IF ( ( Koha.Preference( 'virtualshelves' ) == 1 ) && loggedinusername ) %] >- <a href="#" class="btn btn-link btn-sm newshelf disabled" aria-disabled="true"><i class="fa fa-fw fa-list" aria-hidden="true"></i> Add to list</a> >+ [% IF ( ( Koha.Preference( 'virtualshelves' ) == 1 ) && loggedinusername && ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) ) %] >+ <a href="#" class="btn btn-link btn-sm newshelf disabled" aria-disabled="true"><i class="fa fa-fw fa-list" aria-hidden="true"></i> Add to a list</a> > [% END %] > [% IF ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) %] > <a href="#" class="btn btn-link btn-sm hold disabled" aria-disabled="true"><i class="fa fa-fw fa-bookmark" aria-hidden="true"></i> Place hold</a> >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..cfb48b1445 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -235,7 +235,9 @@ > <div id="floating" class="sticky"> > <div id="toolbar" class="toolbar clearfix"> > <div class="list-actions"> >- <a class="btn btn-link newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form"><i class="fa fa-fw fa-plus" aria-hidden="true"></i> New list</a> <span class="sep">|</span> >+ [% IF ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) %] >+ <a class="btn btn-link newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form"><i class="fa fa-fw fa-plus" aria-hidden="true"></i> New list</a> <span class="sep">|</span> >+ [% END %] > > <div id="download-list" class="btn-group dropdown"> > <a >@@ -568,9 +570,13 @@ > [% ELSE %] > <div id="toolbar" class="toolbar clearfix"> > <div class="list-actions"> >- <a class="btn btn-link newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form"><i class="fa fa-fw fa-plus" aria-hidden="true"></i> New list</a> >+ [% IF ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) %] >+ <a class="btn btn-link newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form"><i class="fa fa-fw fa-plus" aria-hidden="true"></i> New list</a> >+ [% END %] > [% IF can_manage_shelf %] >- <span class="sep">|</span> >+ [% IF ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) %] >+ <span class="sep">|</span> >+ [% END %] > <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="d-inline"> > <input type="hidden" name="op" value="edit_form" /> > <input type="hidden" name="referer" value="view" /> >@@ -745,7 +751,7 @@ > <div id="publicshelves" class="tab-pane active"> </div> > [% END %] > >- [% IF !public || Koha.Preference('OpacAllowPublicListCreation') %] >+ [% IF Koha.Preference('OpacAllowPrivateListCreation') || Koha.Preference('OpacAllowPublicListCreation') %] > [% IF loggedinusername %] > <div id="toolbar" class="toolbar" > ><a class="btn btn-link newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form"><i class="fa fa-plus" aria-hidden="true"></i> New list</a></div >@@ -843,7 +849,7 @@ > </div> > <!-- /.toptabs --> > [% ELSIF NOT loggedinusernumber %] >- [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] >+ [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference('OpacAllowPublicListCreation') || Koha.Preference('OpacAllowPrivateListCreation') ) %] > <div class="alert alert-info"><a href="/cgi-bin/koha/opac-shelves.pl?op=add_form">Log in to create a new list</a></div> > [% END %] > [% END # IF op == 'add_form' OR op == 'edit_form' %] >-- >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 39372
:
179497
|
179498
|
179566
|
181333
|
181334
| 181336 |
181337
|
181338
|
181339