Bug 28157: Add handling for the x-koha-library header
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 20 Apr 2021 17:23:36 +0000 (14:23 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 22 Apr 2021 12:50:12 +0000 (14:50 +0200)
commit6d1b7ca3a05466d5b6307e112adcb94c311f668b
tree5b0e9e1e236cd9c61dba70bce008efc0e99d7b51
parentd84ca49570343b729dd515d50742833cdd07e5fb
Bug 28157: Add handling for the x-koha-library header

This patch introduces a new header handling. The key idea is that on
Koha's base classes there's broad usage of C4::Context->userenv to
determine the current library and make decisions based on that.

API requests, on the other hand, might not be tied to sessions
(stateless) which is the way current library is retrieved. So we need a
way to properly specify what library the request is trying to act as
coming from.

To test:
1. Apply this patchset
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t
=> SUCCESS: Tests pass!
3- Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/REST/V1/Auth.pm