[Bug 44039] New: Merging patrons can delete the patron account of the logged in user
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44039 Bug ID: 44039 Summary: Merging patrons can delete the patron account of the logged in user Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Patrons Assignee: koha-bugs@lists.koha-community.org Reporter: adolfo.rodriguez@xercode.es QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com Target Milestone: --- The patron merge (members/merge-patrons.pl, op cud-merge) does not check whether the logged in user is among the patrons to be merged into the one being kept. If they are, the merge goes ahead and deletes the account of the logged in user. Their session is then left without a patron, and the next request fails with an error 500: Can't call method "libraries_where_can_see_patrons" on an undefined value at Koha/Libraries.pm To reproduce: 1. Create a staff patron with the permission to merge patrons (or a superlibrarian), for example "mergetest", and another patron, for example "mergekeep". 2. Log in to the staff interface as mergetest. 3. Patrons: search for both patrons, select them and click "Merge selected patrons". 4. Choose mergekeep as the patron to keep and click "Merge patrons". 5. The merge is done and mergetest is deleted. Click any link: there is an error 500. Deleting your own account is already prevented in members/deletemem.pl (CANT_DELETE_YOURSELF). The merge should do the same. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44039 Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |adolfo.rodriguez@xercode.es |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44039 --- Comment #1 from Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> --- Created attachment 211098 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211098&action=edit Bug 44039: Do not allow merging the logged in user's patron account into another patron The patron merge (members/merge-patrons.pl) does not check whether the logged in user is among the patrons to be merged into the one being kept. If they are, the merge goes ahead and deletes the account of the logged in user: their session is left without a patron, and the next request fails with an error 500 (Can't call method "libraries_where_can_see_patrons" on an undefined value). This patch stops the merge with an error message when the logged in user is one of the patrons that would be deleted, as members/deletemem.pl already does when deleting a patron (CANT_DELETE_YOURSELF). Keeping the logged in user and merging other patrons into it still works. Steps to follow: 1. Create a staff patron with the permission to merge patrons (or a superlibrarian), for example "mergetest", and another patron, for example "mergekeep". 2. Log in to the staff interface as mergetest (a private window is handy). 3. Patrons: search for both patrons, select them and click "Merge selected patrons". 4. Choose mergekeep as the patron to keep and click "Merge patrons". 5. The merge is done and mergetest is deleted. Click any link: there is an error 500. 6. Log in with your usual user and create mergetest again, as in step 1. 7. Apply the patch. 8. Repeat steps 2 to 4: the merge is not done and there is the message "Merge failed! Your own patron account cannot be merged into another patron, as it would be deleted." Both patrons still exist and you are still logged in. 9. Repeat steps 3 and 4, but choose mergetest as the patron to keep: the merge is done and mergekeep is merged into mergetest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44039 --- Comment #2 from babar junaid <babarjunaid1122@gmail.com> --- Created attachment 211177 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211177&action=edit Bug 44039: Do not allow merging the logged in user's patron account into another patron Bug 44039: Do not allow merging the logged in user's patron account into another patron -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44039 babar junaid <babarjunaid1122@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211098|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44039 --- Comment #3 from babar junaid <babarjunaid1122@gmail.com> --- Tested on main (8199093) in koha-testing-docker, logged in as a superlibrarian staff patron "mergetest". Before the patch: merging mergetest and mergekeep, keeping mergekeep -> the merge request itself returns an error 500 on main, and mergetest's patron account is deleted. After the patch: - keeping mergekeep: "Merge failed! Your own patron account cannot be merged into another patron, as it would be deleted." Both patrons still exist and I am still logged in. - keeping mergetest: the merge is done, mergekeep is merged into mergetest. QA tools pass. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44039 babar junaid <babarjunaid1122@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44039 Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This fixes merging patron release notes| |records so that staff can | |no longer merge their own | |patron account into another | |patron. Previously, if the | |logged-in staff user's | |account was selected as one | |of the records to merge | |(and not as the patron to | |keep), the merge went ahead | |and deleted their account, | |ending their session with | |an error. The merge is now | |stopped and a message | |explains that your own | |patron account cannot be | |merged into another patron, | |as it would be deleted. | |Merging other patrons into | |your own account is still | |allowed. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org