Koha-clms/Koha/REST
Tomas Cohen Arazi 053eb7a4e7 Bug 22071: (follow-up) Simplify code
In order to add features to this method, the current code would force us
to do it for each authentication method.

There's duplicated code that could be simplified. This patch makes the
authentication code just set $user on each block (oauth and cookie
authentication) and moves the final permissions check to the end of the
authenticate_api_request method.

Overall, the behaviour remains unchanged.

To test:
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t \
          t/db_dependent/api/v1/oauth.t
=> SUCCESS: Tests pass! Nothing changed!
- Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 0d5058b7b2)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a6dc145ce9)

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
2019-01-11 19:32:51 +00:00
..
Plugin Bug 21116: Add API routes through plugins 2018-09-20 12:09:27 +01:00
V1 Bug 22071: (follow-up) Simplify code 2019-01-11 19:32:51 +00:00
V1.pm Bug 21334: Add bibliographic content type definitions 2018-09-20 15:02:31 +01:00