Koha-clms/Koha/REST/V1
CJ Lynce e7e8ec8073
Bug 36536: Make REST APIs validateUserAndPassword update borrowers.lastseen
This patch added the option to update borrowers.lastseen when a patron username
    and password is verified via the REST API. This can be enabled or disabled
    selectively using the TrackLastPatronActivityTriggers system preference
    using the [ ] Patron authentication via API option..

To test:
1.  Create a new user, ensuring to set the Username and password fields.
	    *Import to do this first*
2.  Edit the TrackLastPatronActivityTriggers syspref and check all options.
3.  Ensure the RESTBasicAuth syspref is set to Enable.
4.  Check the lastseen date of your new user using a SQL report
        SELECT borrowernumber, userid, lastseen FROM borrowers WHERE userid = 'USERNAME'
        (Replace USERNAME with your chosen username for the new patron)
        NOTE: **Ensure the cache expiry of the SQL report is set to 0**
5.  The lastseen for your new user should be null
6.  'restart_all' Koha services to clear plack cache.
7.  Run the attached api_verify_lastseen.pl test script
        **Change P_USERNAME and P_PASSWORD to the username and password of your new user.
        (script contains expected output for successful verification)
8.  Re-check the lastseen date of your new user again via SQL (step 4)
        The lastseen should still be null.

9.  Apply Patch
10. 'restart_all' Koha services

11. Edit the TrackLastPatronActivityTriggers syspref and check the '[ ] Patron authentication via API' option
12. Rerun the api_verify_lastseen.pl
13. Re-check the lastseen date of your new user again via SQL (step 4)
        The lastseen should now be updated to the time of the last script run.

For good measure:
14. Edit the TrackLastPatronActivityTriggers syspref and **UNcheck** the '[ ] Patron authentication via API' option
15. 'restart_all' Koha services to clear plack cache.
16. Rerun the api_verify_lastseen.pl
17. Re-check the lastseen date of your new user again via SQL (step 4)
        The lastseen should have remained the same as previous.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
Signed-off-by: Bernard Scaife <bernard.scaife@openfifth.co.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ba43483f4d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-09-20 10:43:14 +02:00
..
Acquisitions Bug 38010: Fix vendor deletion tests 2025-05-02 17:19:31 +02:00
Auth Bug 36536: Make REST APIs validateUserAndPassword update borrowers.lastseen 2025-09-20 10:43:14 +02:00
Biblios Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
CashRegisters Bug 39091: Add cash registers list REST API endpoint 2025-08-22 09:47:56 +02:00
Clubs Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Config/SMTP Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ERM Bug 39319: Fixes for Pod::Checker 2025-04-14 08:51:21 +02:00
ILL Bug 39600: Rewrite API controllers 2025-04-25 19:23:41 +02:00
OAuth Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Patrons Bug 28907: REST - Remove allow-owner from public patron hold cancellation 2025-03-06 13:54:32 +01:00
Preservation
…
StockRotation Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
AdditionalContents.pm Bug 39900: REST API specs and class changes 2025-09-20 10:42:42 +02:00
AdvancedEditorMacro.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ArticleRequests.pm Bug 28907: REST - Remove allow-owner from public article requests cancel route 2025-03-06 13:54:33 +01:00
Auth.pm Bug 40423: Add helper to stash x-koha-request-id header value 2025-08-22 09:47:53 +02:00
AuthorisedValueCategories.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
AuthorisedValues.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Authorities.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
BackgroundJobs.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Biblios.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Bookings.pm
…
Checkouts.pm Bug 28907: REST - Remove allow-owner from public checkout availability route 2025-03-06 13:54:33 +01:00
CirculationRules.pm Bug 40419: Fix wrong license 2025-07-24 10:23:34 +02:00
Cities.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
DeletedBiblios.pm
…
ERM.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ExtendedAttributeTypes.pm
…
Holds.pm Bug 40395: Preparation: suspension_bulk REST API endpoint 2025-09-20 10:42:54 +02:00
ImportBatchProfiles.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ImportRecordMatches.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ItemTypes.pm
…
Items.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Libraries.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Lists.pm
…
OAuth.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Patrons.pm Bug 28907: REST - Remove allow-owner from public guarantors can see charges and checkouts 2025-03-06 13:54:31 +01:00
Preservation.pm
…
Quotes.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
RecordSources.pm
…
ReturnClaims.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
SearchFilter.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Static.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Suggestions.pm Bug 40419: Fix wrong license 2025-07-24 10:23:34 +02:00
Tickets.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
TransferLimits.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
TwoFactorAuth.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00