Bugzilla – Attachment 99132 Details for
Bug 24249
OPAC lists page should require login for login-dependent operations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24249: OPAC lists page should require login for login-dependent operations
Bug-24249-OPAC-lists-page-should-require-login-for.patch (text/plain), 6.08 KB, created by
Katrin Fischer
on 2020-02-17 21:19:27 UTC
(
hide
)
Description:
Bug 24249: OPAC lists page should require login for login-dependent operations
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-02-17 21:19:27 UTC
Size:
6.08 KB
patch
obsolete
>From 8b49d70add31f37ee96aba4fc51a64a21076e95b Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 16 Dec 2019 17:41:42 +0000 >Subject: [PATCH] Bug 24249: OPAC lists page should require login for > login-dependent operations > >This patch modifies opac-shelves.pl so that login is required if the >requested operation is anything but "view" and "list." > >The patch also modifies a couple of "Log in to create a new list" links >so that they point to the list creation form instead of opac-user.pl. > >To test, apply the patch and go to the main lists page (the list of >lists) in the OPAC while not logged in. > > - Click the "Log in to create a new list" link. > - Log in. > - You should be taken to the "Create a new list" form. > - Also test the "New list" link shown in the toolbar when you're > viewing the contents of a list. > - When not logged in click the "Lists" menu in the page's header menu. > Clicking "Log in to create a new list" should take you to the login > form and then to the list creation form. > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../opac-tmpl/bootstrap/en/includes/masthead.inc | 7 +----- > .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 4 ++-- > opac/opac-shelves.pl | 27 +++++++++++++++------- > 3 files changed, 22 insertions(+), 16 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index 5ee70cc322..a54b7ccc42 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -68,12 +68,7 @@ > [% END %] > <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=add_form" tabindex="-1" role="menuitem" class="listmenulink">New list</a></li> > [% ELSE %] >- [% IF Koha.Preference('casAuthentication') %] >- [%# CAS authentication is too complicated for modal window %] >- <li role="presentation"><a href="/cgi-bin/koha/opac-user.pl" tabindex="-1" class="menu-inactive" role="menuitem">Log in to create your own lists</a></li> >- [% ELSE %] >- <li role="presentation"><a href="/cgi-bin/koha/opac-user.pl" tabindex="-1" class="menu-inactive loginModal-trigger" role="menuitem">Log in to create your own lists</a></li> >- [% END %] >+ <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=add_form" tabindex="-1" class="menu-inactive" role="menuitem">Log in to create your own lists</a></li> > [% END # / IF loggedinusername %] > [% END # / IF opacuserlogin %] > </ul> <!-- / .dropdown-menu --> >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 424ae632c7..ebaa86e27d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -638,7 +638,7 @@ > <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"></i> New list</a></div> > [% ELSE %] > [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] >- <div class="alert alert-info"><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new lists.</div> >+ <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 %] > >@@ -713,7 +713,7 @@ > </div> [%# <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all"> %] > [% ELSIF NOT loggedinusernumber %] > [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] >- <div class="alert alert-info"><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new lists.</div> >+ <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 loggedinusername %] > </div> <!-- / #usershelves --> >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index 6c21573d5d..cd04709af3 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -50,14 +50,25 @@ if ( ! C4::Context->preference('virtualshelves') ) { > exit; > } > >-my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ >- template_name => $template_name, >- query => $query, >- type => "opac", >- authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), >- }); >- >-my $op = $query->param('op') || 'list'; >+my $op = $query->param('op') || 'list'; >+my ( $template, $loggedinuser, $cookie ); >+ >+if( $op eq 'view' || $op eq 'list' ){ >+ ( $template, $loggedinuser, $cookie ) = get_template_and_user({ >+ template_name => $template_name, >+ query => $query, >+ type => "opac", >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), >+ }); >+} else { >+ ( $template, $loggedinuser, $cookie ) = get_template_and_user({ >+ template_name => $template_name, >+ query => $query, >+ type => "opac", >+ authnotrequired => 0, >+ }); >+} >+ > my $referer = $query->param('referer') || $op; > my $category = $query->param('category') || 1; > my ( $shelf, $shelfnumber, @messages ); >-- >2.11.0
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 24249
:
96350
|
97683
|
98824
|
98886
| 99132