Koha-clms/api/v1/swagger/definitions
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
..
account_line.yaml Bug 29453: Add endpoints for fetching patron credits & debits 2023-05-05 12:13:50 -03:00
advancededitormacro.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
allows_renewal.yaml Bug 29620: Move the OpenAPI spec to YAML format 2021-12-07 12:33:35 -10:00
authorised_value.yaml Bug 32981: Add endpoint to get AV for given category 2023-03-02 12:00:10 -03:00
authorised_value_category.yaml Bug 32997: Add REST API endpoint to list authorised values for multiple given categories 2023-03-02 12:00:15 -03:00
basket.yaml Bug 29620: Move the OpenAPI spec to YAML format 2021-12-07 12:33:35 -10:00
bundle_link.yaml Bug 33021: Show an alert when adding a reserved item to an item bundle 2023-03-27 12:50:05 +02:00
cashup.yaml Bug 29620: Move the OpenAPI spec to YAML format 2021-12-07 12:33:35 -10:00
checkout.yaml Bug 32801: Prevent 500 on /checkouts 2023-07-12 14:30:51 -03:00
checkout_availability.yaml Bug 23336: (follow-up) Add checkout_availability schema 2023-07-05 12:17:19 -03:00
checkouts.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
circ-rule-kind.yaml Bug 29620: Move the OpenAPI spec to YAML format 2021-12-07 12:33:35 -10:00
city.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
club_hold.yaml Bug 29620: Move the OpenAPI spec to YAML format 2021-12-07 12:33:35 -10:00
club_hold_patron_hold.yaml Bug 29620: Move the OpenAPI spec to YAML format 2021-12-07 12:33:35 -10:00
club_hold_patron_holds.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
club_holds.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
credit.yaml Bug 29453: (follow-up) Add tests and fix minimum amount in credit.yaml definition 2023-05-05 12:13:51 -03:00
debit.yaml Bug 21043: Add debit REST endpoint 2023-05-05 12:13:51 -03:00
erm_agreement.yaml Bug 32030: Add users to licenses - REST API Spec 2022-11-08 09:44:49 -03:00
erm_agreement_license.yaml Bug 32030: ERM - link licenses to an agreement 2022-11-08 09:43:45 -03:00
erm_agreement_period.yaml Bug 32030: ERM - FIX swagger specs for bug 30194 2022-11-08 09:43:40 -03:00
erm_agreement_relationship.yaml Bug 32030: ERM - related agreement - REST API 2022-11-08 09:43:51 -03:00
erm_config.yaml Bug 33606: Add a erm/config route to retrieve the ERM config needed for the Vue app 2023-07-06 12:24:13 -03:00
erm_counter_file.yaml Bug 34587: API swagger paths and definitions 2023-10-31 16:45:53 -03:00
erm_counter_log.yaml Bug 34587: Remove counter files from API embedding to improve performance 2023-10-31 16:46:21 -03:00
erm_counter_registry.yaml Bug 34587: Add integration with the counter registry API 2023-10-31 16:46:17 -03:00
erm_custom_report.yaml Bug 34587: Abstract reports backend to allow new data types 2023-10-31 16:46:07 -03:00
erm_default_usage_report.yaml Bug 34587: Add default report capability to reports viewer 2023-10-31 16:46:02 -03:00
erm_document.yaml Bug 32030: Add document to license - REST API spec 2022-11-08 09:44:31 -03:00
erm_eholdings_package.yaml Bug 32030: Add Notes field to erm_eholdings_packages table 2022-11-08 09:44:26 -03:00
erm_eholdings_package_agreement.yaml Bug 32030: Rename Package|Resource|Title 2022-11-08 09:44:02 -03:00
erm_eholdings_resource.yaml Bug 32030: Proxy with HoldingsIQ 2022-11-08 09:44:07 -03:00
erm_eholdings_title.yaml Bug 34789: Database and API update 2023-09-18 12:06:17 -03:00
erm_license.yaml Bug 32030: Add users to licenses - REST API Spec 2022-11-08 09:44:49 -03:00
erm_license_agreement.yaml Bug 32030: ERM - link licenses to an agreement 2022-11-08 09:43:45 -03:00
erm_sushi_service.yaml Bug 34587: Add integration with the counter registry API 2023-10-31 16:46:17 -03:00
erm_usage_data_provider.yaml Bug 34587: Remove counter files from API embedding to improve performance 2023-10-31 16:46:21 -03:00
erm_usage_database.yaml Bug 34587: Add list endpoints for usage_databases/items/platforms 2023-10-31 16:46:08 -03:00
erm_usage_item.yaml Bug 34587: Add list endpoints for usage_databases/items/platforms 2023-10-31 16:46:08 -03:00
erm_usage_mus.yaml Bug 34587: Move YOP to mus/yus instead of erm_usage_titles 2023-10-31 16:46:29 -03:00
erm_usage_platform.yaml Bug 34587: Add list endpoints for usage_databases/items/platforms 2023-10-31 16:46:08 -03:00
erm_usage_title.yaml Bug 34587: Move YOP to mus/yus instead of erm_usage_titles 2023-10-31 16:46:29 -03:00
erm_usage_yus.yaml Bug 34587: Move YOP to mus/yus instead of erm_usage_titles 2023-10-31 16:46:29 -03:00
erm_user_role.yaml Bug 32154: Missing primary key on erm_user_roles table 2022-11-11 08:54:34 -03:00
error.yaml Bug 28020: Add error_code to error responses 2022-01-05 13:33:46 -10:00
fund.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
hold.yaml Bug 34333: Add embed option for `cancellation_requested` for holds 2023-09-18 15:31:49 -03:00
holds.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
identity_provider.yaml Bug 33859: Use the phrase 'Identity providers' instead of 'Authentication providers' 2023-06-05 14:36:03 -03:00
identity_provider_domain.yaml Bug 33859: Use the phrase 'Identity providers' instead of 'Authentication providers' 2023-06-05 14:36:03 -03:00
ill_backend.yaml Bug 22440: Move backend statuses api endpoint 2023-05-05 09:13:43 -03:00
ill_backends.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
ill_batch.yaml Bug 30719: (QA follow-up) Pick better column names and cleanup 2023-10-17 14:45:23 -03:00
ill_batches.yaml Bug 30719: (QA follow-up) Rename illbatches endpoint to ill/batches 2023-10-17 14:45:20 -03:00
ill_batchstatus.yaml Bug 30719: (QA follow-up) Rename illbatchstatuses 2023-10-17 14:45:22 -03:00
ill_batchstatuses.yaml Bug 30719: (QA follow-up) Rename illbatchstatuses 2023-10-17 14:45:22 -03:00
ill_request.yaml Bug 30719: Rename `batch` for `ill_batch` in Koha::Illrequest 2023-10-17 14:45:25 -03:00
ill_status.yaml Bug 22440: ILL API changes 2023-05-05 09:13:42 -03:00
import_batch_profile.yaml Bug 29620: Move the OpenAPI spec to YAML format 2021-12-07 12:33:35 -10:00
import_batch_profiles.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
import_record_match.yaml Bug 22785: Allow option to choose which record match is applied during import 2022-05-03 11:19:50 -10:00
invoice.yaml Bug 29620: Move the OpenAPI spec to YAML format 2021-12-07 12:33:35 -10:00
item.yaml Bug 31212: Adjust item spec for last_seen_date 2023-05-15 08:53:46 -03:00
item_group.yaml Bug 24857: API spec 2022-07-08 15:59:55 -03:00
job.yaml Bug 30982: API tweaks 2022-09-23 08:57:49 -03:00
library.yaml Bug 32721: (QA follow-up) Drop fields from API response 2023-10-19 16:00:56 -03:00
order.yaml Bug 8179: Receive multiple orders 2023-05-15 08:53:47 -03:00
patron.yaml Bug 26170: Add protected status for patrons 2023-11-01 17:23:06 -03:00
patron_account_credit.yaml Bug 23012: Show the PROCESSING_FOUND account credit type 2022-10-24 17:43:28 -03:00
patron_balance.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
patron_extended_attribute.yaml Bug 31381: Handle null attributes in list 2022-11-30 15:58:13 -03:00
preservation_config.yaml Bug 30708: Do not allow non-authorised users to edit the settings 2023-10-18 15:42:01 -03:00
preservation_processing.yaml Bug 33547: Add print slip 2023-10-23 11:33:51 -03:00
preservation_processing_attribute.yaml Bug 30708: REST API specs 2023-10-18 15:41:40 -03:00
preservation_train.yaml Bug 30708: Fix API specs 2023-10-20 10:00:58 -03:00
preservation_train_item.yaml Bug 30708: Adjust spec for train_item 2023-10-20 14:44:05 -03:00
quote.yaml Bug 30903: Fix POST /quote 2022-07-06 16:42:05 -03:00
renewal.yaml Bug 30642: Make renewal_type an enum in spec and add test 2023-02-10 11:08:00 -03:00
renewals.yaml Bug 30275: (follow-up) Rebase fixes 2022-07-05 09:46:12 -03:00
return_claim.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
search_filter.yaml Bug 17170: (QA follow-up) Spec cleanup 2022-10-21 11:15:22 -03:00
smtp_server.yaml Bug 27424: Add ability to specify an SMTP server in the database as the default server 2023-01-31 10:52:48 -03:00
suggestion.yaml Bug 32942: (follow-up) Fix typo 2023-09-19 15:51:39 -03:00
ticket.yaml Bug 31028: Add catalog concern management page to staff 2023-03-06 11:23:17 -03:00
ticket_update.yaml Bug 31028: Add catalog concern management page to staff 2023-03-06 11:23:17 -03:00
transfer_limit.yaml Bug 29620: Move the OpenAPI spec to YAML format 2021-12-07 12:33:35 -10:00
vendor.yaml Bug 33103: Embed aliases in GET /vendors 2023-04-20 15:48:38 -03:00
vendor_alias.yaml Bug 33103: Embed aliases in GET /vendors 2023-04-20 15:48:38 -03:00
vendor_issue.yaml Bug 33105: Fix vendor api spec 2023-07-20 10:59:29 -03:00