Bugzilla – Attachment 135176 Details for
Bug 30700
Patrons who can log into staff interface should be able to change their own password
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30700: (follow-up) Add system preference StaffLoginResetPassword
Bug-30700-follow-up-Add-system-preference-StaffLog.patch (text/plain), 6.90 KB, created by
Aleisha Amohia
on 2022-05-19 01:49:54 UTC
(
hide
)
Description:
Bug 30700: (follow-up) Add system preference StaffLoginResetPassword
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2022-05-19 01:49:54 UTC
Size:
6.90 KB
patch
obsolete
>From b53a6e1bb8fb8e9b56e05b265aa3ace27d4e2c13 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 18 May 2022 04:23:55 +0000 >Subject: [PATCH] Bug 30700: (follow-up) Add system preference > StaffLoginResetPassword > >This syspref wraps around the functionality added for patrons with the >'catalogue' permission to reset their own password via the staff client. >--- > .../bug_30700_-_add_StaffLoginResetPassword_syspref.pl | 12 ++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > koha-tmpl/intranet-tmpl/prog/en/includes/header.inc | 8 +++++--- > koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc | 2 +- > .../prog/en/modules/admin/preferences/staff_interface.pref | 6 ++++++ > members/member-password.pl | 2 +- > 6 files changed, 26 insertions(+), 5 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_30700_-_add_StaffLoginResetPassword_syspref.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_30700_-_add_StaffLoginResetPassword_syspref.pl b/installer/data/mysql/atomicupdate/bug_30700_-_add_StaffLoginResetPassword_syspref.pl >new file mode 100644 >index 00000000000..08f1a46bb47 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_30700_-_add_StaffLoginResetPassword_syspref.pl >@@ -0,0 +1,12 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "30700", >+ description => "Add new system preference StaffLoginResetPassword", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ >+ $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('StaffLoginResetPassword', '0', NULL, 'If enabled, patrons with access to the staff interface can change their password via the staff interface.', 'YesNo') }); >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 581e6be18ba..1c28675f17b 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -649,6 +649,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('StaffHighlightedWords','1','','Highlight search terms on staff interface','YesNo'), > ('StaffLangSelectorMode','footer','top|both|footer','Select the location to display the language selector in staff interface','Choice'), > ('StaffLoginInstructions', '', NULL, 'HTML to go into the login box for the staff interface','Free'), >+('StaffLoginResetPassword', '0', NULL, 'If enabled, patrons with access to the staff interface can change their password via the staff interface.', 'YesNo'), > ('StaffSearchResultsDisplayBranch','holdingbranch','holdingbranch|homebranch','Controls the display of the home or holding branch for staff search results','Choice'), > ('StaffSerialIssueDisplayCount','3','','Number of serial issues to display per subscription in the staff interface','Integer'), > ('StaticHoldsQueueWeight','0',NULL,'Specify a list of library location codes separated by commas -- the list of codes will be traversed and weighted with first values given higher weight for holds fulfillment -- alternatively, if RandomizeHoldsQueueWeight is set, the list will be randomly selective','Integer'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >index 2e4fbb6ba90..20d7bb665ba 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >@@ -193,9 +193,11 @@ > </li> > [% END %] > >- <li class ="toplinks-changepassword"> >- <a class="toplinks" href="/cgi-bin/koha/members/member-password.pl?member=[% loggedinusernumber | html %]">Change password</a> >- </li> >+ [% IF Koha.Preference('StaffLoginResetPassword') %] >+ <li class ="toplinks-changepassword"> >+ <a class="toplinks" href="/cgi-bin/koha/members/member-password.pl?member=[% loggedinusernumber | html %]">Change password</a> >+ </li> >+ [% END %] > > <li> > <a id="logout" class="toplinks" href="/cgi-bin/koha/mainpage.pl?logout.x=1">Log out</a> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >index c5a8c794c0f..bf9ba04fcb6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >@@ -15,7 +15,7 @@ > [% END %] > <a id="duplicate" class="btn btn-default" href="/cgi-bin/koha/members/memberentry.pl?op=duplicate&borrowernumber=[% patron.borrowernumber | html %]"><i class="fa fa-copy"></i> Duplicate</a> > [% END %] >- [% IF CAN_user_borrowers_edit_borrowers || patron.borrowernumber == logged_in_user.borrowernumber %] >+ [% IF CAN_user_borrowers_edit_borrowers || ( Koha.Preference('StaffLoginResetPassword') && patron.borrowernumber == logged_in_user.borrowernumber ) %] > <a id="changepassword" class="btn btn-default" href="/cgi-bin/koha/members/member-password.pl?member=[% patron.borrowernumber | html %]"><i class="fa fa-lock"></i> Change password</a> > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref >index cb6277d4aa6..deb31afb4bd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref >@@ -193,6 +193,12 @@ Staff interface: > 1: Show > 0: "Don't show" > - a search field pulldown for 'Search the catalog' boxes. >+ - >+ - pref: StaffLoginResetPassword >+ choices: >+ 1: Allow >+ 0: "Don't allow" >+ - patrons with access to the staff interface (have the <em>catalogue</em> permission) to change their password via the staff interface. > Authentication: > - > - pref: staffShibOnly >diff --git a/members/member-password.pl b/members/member-password.pl >index 40adcfb0fc0..9e574b61a70 100755 >--- a/members/member-password.pl >+++ b/members/member-password.pl >@@ -35,7 +35,7 @@ my ( $template, $loggedinuser, $cookie, $staffflags ) = get_template_and_user( > my $patron_id = $input->param('member'); > my $logged_in_user = Koha::Patrons->find( $loggedinuser ); > >-if ( !$logged_in_user->has_permission({ borrowers => 'edit_borrowers' }) and $loggedinuser != $patron_id ) { >+if ( !$logged_in_user->has_permission({ borrowers => 'edit_borrowers' }) and ( $loggedinuser != $patron_id and C4::Context->preference('StaffLoginResetPassword') ) ) { > print $input->redirect("/cgi-bin/koha/errors/404.pl"); > > } else { >-- >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 30700
:
134669
|
134772
|
135087
|
135173
|
135174
|
135176
|
153248
|
153249
|
153250
|
153290
|
153291
|
153292
|
156512
|
156513
|
156514
|
156515
|
156516