]> git.koha-community.org Git - koha.git/commit
Bug 22071: (follow-up) Simplify code
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 7 Jan 2019 10:31:43 +0000 (07:31 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 10 Jan 2019 14:22:50 +0000 (14:22 +0000)
commita6dc145ce966338ec0ae96f7e32968149647c02f
treead1c4135ea783c6003217a91d73ecff0d9f57528
parent84ddb45e884394d08ba4dc836d3209e11e351048
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 0d5058b7b29d90cc7c8e533ee56388fbb5a96d52)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/REST/V1/Auth.pm