Bug 10796

Summary: Allow password changes for logged in OPAC users by patron category
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: PatronsAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: 1joynelson, gmcharlt, kyle.m.hall, martin.renvoize, nick, tomascohen, veron, wizzyrea
Version: master   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=3032
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Libraries can now specify which patrons are allowed to change their password when logged into the OPAC, per patron category. A common use case for this would be a system that combines LDAP (or other external authentication) patrons and local Koha patrons. This feature will allow libraries to present a better user experience for password management to all of their patrons, no matter how they are authenticated.
Version(s) released in:
19.05.00
Bug Depends on: 21890    
Bug Blocks: 29272    
Attachments: Bug 10796: DB update
Bug 10796: Add Koha::Patron::Category->effective_change_password method
Bug 10796: Handle can_change_password on the staff interface
Bug 10796: Use $category->effective_change_password in the OPAC
Bug 10796: DBIC update
Bug 10796: DB update
Bug 10796: Add Koha::Patron::Category->effective_change_password method
Bug 10796: Handle can_change_password on the staff interface
Bug 10796: Use $category->effective_change_password in the OPAC
Bug 10796: (QA Follow-up) Changing password recovery verbiage for users who are disallowed online password resets
Bug 10796: DB update
Bug 10796: Add Koha::Patron::Category->effective_change_password method
Bug 10796: Handle can_change_password on the staff interface
Bug 10796: Use $category->effective_change_password in the OPAC
Bug 10796: (QA follow-up) Changing password recovery verbiage for users who are disallowed online password resets

Description Katrin Fischer 2013-08-28 08:48:07 UTC
When using LDAP or another central authentication you don't want patrons to change passwords in the OPAC, but at the same time you might have local users that should be allowed to change their password.

I think it would be nice if we could move OpacPasswordChange from a global system preference to the patron category confguration page.

This is similar to bug 3032 - but would not be per patron, but only per patron category.
Comment 1 Tomás Cohen Arazi 2019-02-20 17:09:47 UTC
Created attachment 85389 [details] [review]
Bug 10796: DB update
Comment 2 Tomás Cohen Arazi 2019-02-20 17:09:50 UTC
Created attachment 85390 [details] [review]
Bug 10796: Add Koha::Patron::Category->effective_change_password method

This method checks whether the local $self->change_password is set to
override the OpacPasswordChange syspref (i.e. if it is set to a
bool) or undef, in which case it falls back to the value of the syspref

To test:
- Apply this patches
- Make sure the DB is updated:
  $ updatedatabase
- Update the schema files:
  $ dbic
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Patron/Category.t
=> SUCCESS: Tests pass!
- Sign off :-D
Comment 3 Tomás Cohen Arazi 2019-02-20 17:09:54 UTC
Created attachment 85391 [details] [review]
Bug 10796: Handle can_change_password on the staff interface

This patch makes the staff interface handle the new flag when editing
the categories. I didn't add the flag to the list of categories table
because it makes it too big, but can be easily added if required by
users or QA.

To test:
- Along with other patches from this bug, edit patron categories
=> SUCCESS: Notice the changes are correctly stored
- Sign off :-D
Comment 4 Tomás Cohen Arazi 2019-02-20 17:09:57 UTC
Created attachment 85392 [details] [review]
Bug 10796: Use $category->effective_change_password in the OPAC

This patch makes the OPAC pages that rely on OpacPasswordChange use the
current patron's category to make the decision to allow password change
or not.

It does so by making sure all the places in which OpacPasswordChange was
used, use $logged_in_user->category->effective_change_password instead.

Special attention is required on the case of opac-registration-verify.pl
in which the use of an unblessed Koha::Patron object is changed in
favour of the blessed object, so we can actually use the new method to
make a decision on the text to display.

To test:
- Go through the OPAC pages, check that the password change strings and
links are displayed only whne appropriate.
- Sign off :-D
Comment 5 Tomás Cohen Arazi 2019-02-20 17:10:01 UTC
Created attachment 85393 [details] [review]
Bug 10796: DBIC update
Comment 6 Tomás Cohen Arazi 2019-03-21 14:27:24 UTC
Obsoleted the DBIC update as well, as it is counter-productive.
Comment 7 Liz Rea 2019-03-27 19:28:45 UTC
Created attachment 87117 [details] [review]
Bug 10796: DB update

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 8 Liz Rea 2019-03-27 19:28:48 UTC
Created attachment 87118 [details] [review]
Bug 10796: Add Koha::Patron::Category->effective_change_password method

This method checks whether the local $self->change_password is set to
override the OpacPasswordChange syspref (i.e. if it is set to a
bool) or undef, in which case it falls back to the value of the syspref

To test:
- Apply this patches
- Make sure the DB is updated:
  $ updatedatabase
- Update the schema files:
  $ dbic
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Patron/Category.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 9 Liz Rea 2019-03-27 19:28:51 UTC
Created attachment 87119 [details] [review]
Bug 10796: Handle can_change_password on the staff interface

This patch makes the staff interface handle the new flag when editing
the categories. I didn't add the flag to the list of categories table
because it makes it too big, but can be easily added if required by
users or QA.

To test:
- Along with other patches from this bug, edit patron categories
=> SUCCESS: Notice the changes are correctly stored
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 10 Liz Rea 2019-03-27 19:28:53 UTC
Created attachment 87120 [details] [review]
Bug 10796: Use $category->effective_change_password in the OPAC

This patch makes the OPAC pages that rely on OpacPasswordChange use the
current patron's category to make the decision to allow password change
or not.

It does so by making sure all the places in which OpacPasswordChange was
used, use $logged_in_user->category->effective_change_password instead.

Special attention is required on the case of opac-registration-verify.pl
in which the use of an unblessed Koha::Patron object is changed in
favour of the blessed object, so we can actually use the new method to
make a decision on the text to display.

To test:
- Go through the OPAC pages, check that the password change strings and
links are displayed only whne appropriate.
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 11 Liz Rea 2019-03-27 19:28:56 UTC
Created attachment 87121 [details] [review]
Bug 10796: (QA Follow-up) Changing password recovery verbiage for users who are disallowed online password resets
Comment 12 Tomás Cohen Arazi 2019-03-27 19:37:19 UTC
(In reply to Liz Rea from comment #11)
> Created attachment 87121 [details] [review] [review]
> Bug 10796: (QA Follow-up) Changing password recovery verbiage for users who
> are disallowed online password resets

Thank you!!!
Comment 13 Martin Renvoize 2019-04-01 18:23:26 UTC
Created attachment 87296 [details] [review]
Bug 10796: DB update

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Martin Renvoize 2019-04-01 18:23:29 UTC
Created attachment 87297 [details] [review]
Bug 10796: Add Koha::Patron::Category->effective_change_password method

This method checks whether the local $self->change_password is set to
override the OpacPasswordChange syspref (i.e. if it is set to a
bool) or undef, in which case it falls back to the value of the syspref

To test:
- Apply this patches
- Make sure the DB is updated:
  $ updatedatabase
- Update the schema files:
  $ dbic
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Patron/Category.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 15 Martin Renvoize 2019-04-01 18:23:32 UTC
Created attachment 87298 [details] [review]
Bug 10796: Handle can_change_password on the staff interface

This patch makes the staff interface handle the new flag when editing
the categories. I didn't add the flag to the list of categories table
because it makes it too big, but can be easily added if required by
users or QA.

To test:
- Along with other patches from this bug, edit patron categories
=> SUCCESS: Notice the changes are correctly stored
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 16 Martin Renvoize 2019-04-01 18:23:35 UTC
Created attachment 87299 [details] [review]
Bug 10796: Use $category->effective_change_password in the OPAC

This patch makes the OPAC pages that rely on OpacPasswordChange use the
current patron's category to make the decision to allow password change
or not.

It does so by making sure all the places in which OpacPasswordChange was
used, use $logged_in_user->category->effective_change_password instead.

Special attention is required on the case of opac-registration-verify.pl
in which the use of an unblessed Koha::Patron object is changed in
favour of the blessed object, so we can actually use the new method to
make a decision on the text to display.

To test:
- Go through the OPAC pages, check that the password change strings and
links are displayed only whne appropriate.
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 17 Martin Renvoize 2019-04-01 18:23:38 UTC
Created attachment 87300 [details] [review]
Bug 10796: (QA follow-up) Changing password recovery verbiage for users who are disallowed online password resets

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 18 Martin Renvoize 2019-04-01 18:25:07 UTC
Nice useful enhancement.

No regressions found, QA scripts pass (with the exception of a false failure in the template check)

Passing QA
Comment 19 Nick Clemens 2019-04-12 13:00:09 UTC
Awesome work all!

Pushed to master for 19.05
Comment 20 Martin Renvoize 2019-04-25 13:19:20 UTC
Enhancement will not be backported to 18.11.x series.