Bugzilla – Attachment 133760 Details for
Bug 29926
Add ability for superlibrarians to edit password expiration dates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29926: Add ability for superlibrarian to view/edit password expiration
Bug-29926-Add-ability-for-superlibrarian-to-viewed.patch (text/plain), 7.88 KB, created by
Nick Clemens (kidclamp)
on 2022-04-25 12:05:25 UTC
(
hide
)
Description:
Bug 29926: Add ability for superlibrarian to view/edit password expiration
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-04-25 12:05:25 UTC
Size:
7.88 KB
patch
obsolete
>From 875dd835716d6ad527d75ca235dddea04eabe86c Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 14 Feb 2022 16:01:07 +0000 >Subject: [PATCH] Bug 29926: Add ability for superlibrarian to view/edit > password expiration > >To test: > 1 - Sign in as a superlibrarian > 2 - Find a patron account with no password expiration set > 3 - View member detials > 4 - note expiration says 'Never' > 5 - Edit patron > 6 - Set patron expiration > 7- Save > 8 - View details, confirm password expiration shows correctly > 9 - Sign in as non-superlibrarian >10 - Confirm you don't see expirationdate on details page >11 - Edit patron and confirm password expiration does not show >12 - Edit HTML and confirm you epxiration date not saved > <input type="text" name="password_expiration_date" value="2052-05-02"> > >Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org> >--- > .../prog/en/modules/members/memberentrygen.tt | 13 +++++++++++-- > .../prog/en/modules/members/moremember.tt | 10 ++++++++++ > members/memberentry.pl | 10 ++++++++-- > 3 files changed, 29 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index d01b2316bc..e61ae4f688 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -176,6 +176,9 @@ legend:hover { > [% IF ( ERROR_password_mismatch ) %] > <li id="ERROR_password_mismatch">Passwords do not match.</li> > [% END %] >+ [% IF ( ERROR_password_expiration_date ) %] >+ <li id="ERROR_dateexpiry">Password expiration date is invalid.</li> >+ [% END %] > [% IF ( ERROR_extended_unique_id_failed ) %] > <li id="ERROR_extended_unique_id_failed"><strong>[% ERROR_extended_unique_id_failed_description | html %]:</strong> Attribute value "[% ERROR_extended_unique_id_failed_value | html %]" is already in use by another patron record.</li> > [% END %] >@@ -1129,7 +1132,7 @@ legend:hover { > </fieldset> <!-- /#memberentry_subscription --> > [% END # hide fieldset %] > >- [% UNLESS nouserid && nopassword %] >+ [% UNLESS nouserid && nopassword && !CanUpdatePasswordExpiration %] > <fieldset class="rows" id="memberentry_userid"> > <legend id="opac_staff_login_lgd">OPAC/Staff interface login</legend> > <ol> >@@ -1274,9 +1277,15 @@ legend:hover { > [% END %] > </li> > [% END # /UNLESS nopassword %] >+ [% UNLESS ( !CanUpdatePasswordExpiration ) %] >+ <li> >+ <label for="password_expiration_date">Password expiration date:</label> >+ <input type="text" id="password_expiration_date" name="password_expiration_date" maxlength="10" size="10" value="[% password_expiration_date | html %]" class="flatpickr" /> >+ </li> >+ [% END %] > </ol> > </fieldset> <!-- /#memberentry_userid --> >- [% END # UNLESS nouserid && nopassword %] >+ [% END # UNLESS nouserid && nopassword && !CanUpdatePasswordExpiration %] > > <!--this zones are not necessary in modif mode --> > [% UNLESS ( opadd || opduplicate ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 58c0f0a863..9bf69d4a0e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -448,6 +448,16 @@ > <i class="fa fa-exclamation-circle problem" aria-hidden="true"></i> <a href="/cgi-bin/koha/members/member-password.pl?member=[% patron.borrowernumber | uri %]">Undefined</a> > [% END %] > </li> >+ [% IF CAN_user_superlibrarian %] >+ <li id="patron-password_expiration_date"> >+ <span class="label">Password expires:</span> >+ [% IF ( patron.password_expiration_date ) %] >+ [% patron.password_expiration_date | $KohaDates %] >+ [% ELSE %] >+ Never >+ [% END %] >+ </li> >+ [% END %] > > [% IF ( patron.borrowernotes ) %] > <li id="patron-borrowernotes"> >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 4e25891dd0..0f369ebc21 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -92,6 +92,7 @@ my @errors; > my $borrower_data; > my $NoUpdateLogin; > my $NoUpdateEmail; >+my $CanUpdatePasswordExpiration; > my $userenv = C4::Context->userenv; > my @messages; > >@@ -166,6 +167,9 @@ if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) { > if ( $patron->is_superlibrarian && !$logged_in_user->is_superlibrarian ) { > $NoUpdateEmail = 1; > } >+ if ($logged_in_user->is_superlibrarian) { >+ $CanUpdatePasswordExpiration = 1; >+ } > > $borrower_data = $patron->unblessed; > $borrower_data->{category_type} = $patron->category->category_type; >@@ -194,7 +198,7 @@ if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) > } > } > >- foreach (qw(dateenrolled dateexpiry dateofbirth)) { >+ foreach (qw(dateenrolled dateexpiry dateofbirth password_expiration_date)) { > next unless exists $newdata{$_}; > my $userdate = $newdata{$_} or next; > >@@ -244,6 +248,7 @@ if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) > qr/^delete_guarantor$/, > ); > push @keys_to_delete, map { qr/^$_$/ } split( /\s*\|\s*/, C4::Context->preference('BorrowerUnwantedField') || q{} ); >+ push @keys_to_delete, qr/^password_expiration_date$/ unless $CanUpdatePasswordExpiration; > for my $regexp (@keys_to_delete) { > for (keys %newdata) { > delete($newdata{$_}) if /$regexp/; >@@ -792,7 +797,7 @@ if (C4::Context->preference('uppercasesurnames')) { > $data{'contactname'} &&= uc( $data{'contactname'} ); > } > >-foreach (qw(dateenrolled dateexpiry dateofbirth)) { >+foreach (qw(dateenrolled dateexpiry dateofbirth password_expiration_date)) { > if ( $data{$_} ) { > $data{$_} = eval { output_pref({ dt => dt_from_string( $data{$_} ), dateonly => 1 } ); }; # back to syspref for display > } >@@ -839,6 +844,7 @@ $template->param( > nok => $nok,#flag to know if an error > NoUpdateLogin => $NoUpdateLogin, > NoUpdateEmail => $NoUpdateEmail, >+ CanUpdatePasswordExpiration => $CanUpdatePasswordExpiration, > ); > > # Generate CSRF token >-- >2.30.2
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 29926
:
130551
|
130552
|
130553
|
130686
|
130687
|
130688
|
133759
|
133760
|
133761
|
133887
|
133888
|
133889
|
133890
|
133891