https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44143

Andrew Fuerste-Henry <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]
                   |                            |o.uk,
                   |                            |[email protected],
                   |                            |[email protected]
                   |                            |k, [email protected]

--- Comment #1 from Andrew Fuerste-Henry <[email protected]> ---
Claude suggests a broader change to how API actions define their context. This
change and its ramifications all sound correct to me a Claude describes them,
but Claude is an overclocked predictive text tool so I'd love some
knowledgeable human feedback on the question.

The LLM says:
Why it happens. The Vue page logs in to the API with the staff CGISESSID
cookie. That session stores interface = 'intranet' (C4/Auth.pm:1343), and
check_cookie_auth sets it on C4::Context (C4/Auth.pm:1929). But at the end of
authenticate_api_request, Koha/REST/V1/Auth.pm:250 always overwrites it with
C4::Context->interface('api'). logaction then reads C4::Context->interface
(C4/Log.pm:83) and records “api”.

Likely fix. Keep the session’s interface when the request was authenticated by
cookie ($cookie_auth), and use 'api' only for Basic or OAuth requests, which is
what your description says “REST API” should mean.

The catch. That line runs for every API request, not just check-in. The change
would also affect:

every other staff Vue page (ERM, acquisitions, preservation, and so on);
OPAC JavaScript that calls the API with a session cookie, which would start
logging as opac;
any code that checks C4::Context->interface eq 'api' or 'opac'. That includes
the interface stored on account lines and statistics, not just the action logs.

So the question is whether to make the general fix (more correct, but wider
testing and QA) or a fix limited to the check-in endpoint (smaller, but leaves
the same problem everywhere else).

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to