Koha-clms/api/v1/swagger/paths
Magnus Enger 6fec4ea0df
Bug 26170: Add protected status for patrons
This set of patches makes it possible to protect patrons from being accidetally
deleted or merged with other patrons, from the UI and from (well behaved) cron
jobs. The following subroutines are affected:
- Koha::Patron::delete
- Koha::Patron::merge_with
- Koha::Patron::safe_to_delete
- C4::Members::GetBorrowersToExpunge

Please note:
- This does not intend to protect patrons from being edited, only from being
  deleted

To test:

* Tests
- Run the affected tests:
  prove t/db_dependent/Members.t
  prove t/db_dependent/Koha/Patrons.t

* Editing protected status and manual deletion
- Add a new user, note the presence of the "Protected" field under "Library
  management", but leave it at the default "No", for now.
- Note that "Protected" is displayed in the "Library use" section of the patron
  details.
- Note that More > Delete is avaiable as an action when the patron is saved
- Edit the user and set "Protected" to "Yes"
- Note that More > Delete is now disabled, with a note that the patron is protected

* Batch patron deletion
- Go to Tools > Batch patron deletion and anonymization
- Check the box for "Verify you want to delete patrons"
- Choose the category of your protected patron for "whose patron category is"
  and click "Next" to run the actual deletion
- Check that your protected patron was not deleted

* Merging patrons
- Make sure you have two patrons with similar names or the same category, so
  you can find them with one search. One should be protected, one not.
- Search for the patrons, tick their boxes and click on "Merge selected patrons"
- Select one of the patrons as the "patron to keep".
. Click on "Merge patrons"
- "No valid patrons to merge were found" should be shown
- Repeat this with the other patron as the "patron to keep"
(A future enhancement could be to not allow a protected patron to be selected for
merging in the first place.)

* misc/cronjobs/delete_patrons.pl
- Make sure you have a protected patron, in a category with at least one more
  patron.
- Run something like this (at least in ktd):
  $ perl misc/cronjobs/delete_patrons.pl --category_code <code> -v --confirm
  (Replace <code> with the actual categorycode.)
- Make sure the borrowernumber of the protected patron is not mentioned in the
  output of the script.
- Check the protected patron was not deleted
- Check the non-protected patrons were deleted

* REST API (with ktd)
- Make sure you still have a protected patron, and note their borrowernumber
- Enable RESTBasicAuth and restart all the things
- Run these two commands from the command line on the host:
  $ curl -u koha:koha --request GET "http://localhost:8081/api/v1/patrons/54"
  $ curl -u koha:koha --request DELETE "http://localhost:8081/api/v1/patrons/54"
  (Replace 54 with the actual borrowernumber of your protected patron.)
- The first curl command should give you the patron details. The second should
  give this output:
  {"error":"Protected patrons cannot be deleted","error_code":"is_protected"}

There could be more functions/scripts where patrons are deleted that I have not
thought about. Please report them on the bug if you find any!

Update 2023-10-19: Fix "More > Delete" on patron, so link can not be clicked.
Update 2023-10-19: Rebase

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-11-01 17:23:06 -03:00
..
acquisitions_baskets.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
acquisitions_funds.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
acquisitions_orders.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
acquisitions_vendor_issues.yaml Bug 33105: (QA follow-up) REST API 2023-07-20 10:59:29 -03:00
acquisitions_vendors.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
advancededitormacros.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
article_requests.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
auth.yaml Bug 34313: Add patron information in pass validation response 2023-08-29 14:59:02 -03:00
authorised_value_categories.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
authorised_values.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
authorities.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
biblios.yaml Bug 34211: Add +strings for GET /api/v1/biblios/:biblio_id/items 2023-07-13 15:19:34 -03:00
biblios_item_groups.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
cash_registers.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
checkouts.yaml Bug 30979: Fix xt/api.t 2023-07-14 16:52:02 -03:00
circulation-rules.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
cities.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
clubs.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
config_smtp_servers.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
erm_agreements.yaml Bug 34387: Improve API docs naming consistency 2023-08-15 11:25:35 +03:00
erm_config.yaml Bug 34387: Improve API docs naming consistency 2023-08-15 11:25:35 +03:00
erm_counter_files.yaml Bug 34587: Move everything into a ERM/EUsage subfolder 2023-10-31 16:46:18 -03:00
erm_counter_logs.yaml Bug 34587: Remove counter files from API embedding to improve performance 2023-10-31 16:46:21 -03:00
erm_counter_registries.yaml Bug 34587: Move everything into a ERM/EUsage subfolder 2023-10-31 16:46:18 -03:00
erm_custom_reports.yaml Bug 34587: Move everything into a ERM/EUsage subfolder 2023-10-31 16:46:18 -03:00
erm_default_usage_reports.yaml Bug 34587: Fix ->validation->output in API endpoints 2023-10-31 16:46:30 -03:00
erm_documents.yaml Bug 34387: Improve API docs naming consistency 2023-08-15 11:25:35 +03:00
erm_eholdings_packages.yaml Bug 34387: Improve API docs naming consistency 2023-08-15 11:25:35 +03:00
erm_eholdings_packages_resources.yaml Bug 34387: Improve API docs naming consistency 2023-08-15 11:25:35 +03:00
erm_eholdings_resources.yaml Bug 34387: Improve API docs naming consistency 2023-08-15 11:25:35 +03:00
erm_eholdings_titles.yaml Bug 34789: Database and API update 2023-09-18 12:06:17 -03:00
erm_eholdings_titles_resources.yaml Bug 34387: Improve API docs naming consistency 2023-08-15 11:25:35 +03:00
erm_licenses.yaml Bug 34387: Improve API docs naming consistency 2023-08-15 11:25:35 +03:00
erm_sushi_services.yaml Bug 34587: Fix stray type definition 2023-11-01 15:00:17 -03:00
erm_usage_data_providers.yaml Bug 34587: Improve SUSHI COUNTER error handling 2023-10-31 16:46:25 -03:00
erm_usage_databases.yaml Bug 34587: Move everything into a ERM/EUsage subfolder 2023-10-31 16:46:18 -03:00
erm_usage_items.yaml Bug 34587: Move everything into a ERM/EUsage subfolder 2023-10-31 16:46:18 -03:00
erm_usage_platforms.yaml Bug 34587: Move everything into a ERM/EUsage subfolder 2023-10-31 16:46:18 -03:00
erm_usage_titles.yaml Bug 34587: Move everything into a ERM/EUsage subfolder 2023-10-31 16:46:18 -03:00
erm_users.yaml Bug 34387: Improve API docs naming consistency 2023-08-15 11:25:35 +03:00
holds.yaml Bug 34333: Add embed option for `cancellation_requested` for holds 2023-09-18 15:31:49 -03:00
ill_backends.yaml Bug 22440: Move backend statuses api endpoint 2023-05-05 09:13:43 -03:00
ill_batches.yaml Bug 30719: (QA follow-up) Pick better column names and cleanup 2023-10-17 14:45:23 -03:00
ill_batchstatuses.yaml Bug 30719: (QA follow-up) Rename illbatchstatuses 2023-10-17 14:45:22 -03:00
ill_requests.yaml Bug 30719: Rename `batch` for `ill_batch` in Koha::Illrequest 2023-10-17 14:45:25 -03:00
import_batch_profiles.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
import_batches.yaml Bug 30855: Rename /import => /import_batches 2022-06-02 13:42:28 -03:00
items.yaml Bug 34054: Allow to embed biblio on GET /items 2023-09-22 11:35:43 -03:00
jobs.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
libraries.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
oauth.yaml Bug 32354: Accept session_state param given by OAuth IdP 2022-12-07 12:58:32 -03:00
patrons.yaml Bug 26170: Add protected status for patrons 2023-11-01 17:23:06 -03:00
patrons_account.yaml Bug 34387: Improve API docs naming consistency 2023-08-15 11:25:35 +03:00
patrons_extended_attributes.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
patrons_holds.yaml Bug 34333: Add embed option for `cancellation_requested` for holds 2023-09-18 15:31:49 -03:00
patrons_password.yaml Bug 29926: (QA follow-up) Date format missing in spec 2022-05-06 10:33:10 -10:00
preservation_config.yaml Bug 30708: Rebase - Use a dedicated 'config' endpoint 2023-10-18 15:42:00 -03:00
preservation_processings.yaml Bug 30708: Remove q_header from specs 2023-10-18 15:41:57 -03:00
preservation_trains.yaml Bug 33547: Add print slip 2023-10-23 11:33:51 -03:00
preservation_waiting_list.yaml Bug 30708: Adjust spec for train_item 2023-10-20 14:44:05 -03:00
public_oauth.yaml Bug 32354: Accept session_state param given by OAuth IdP 2022-12-07 12:58:32 -03:00
public_patrons.yaml Bug 30979: (QA follow-up) Add missing docs on error codes 2023-07-14 12:14:46 -03:00
quotes.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
return_claims.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
rotas.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
search_filters.yaml Bug 34387: Improve API docs naming consistency 2023-08-15 11:25:35 +03:00
suggestions.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
tickets.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00
transfer_limits.yaml Bug 33971: Remove x-koha-query header support 2023-07-03 10:35:06 -03:00