Bug 28785: Centralize cookie auth check in check_cookie_auth
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 29 Jul 2021 09:03:46 +0000 (11:03 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 18 Oct 2021 09:28:41 +0000 (11:28 +0200)
commit6545259bbf8a8683ade45c65aa57a00a8981fbae
treebf3c97f91be7dbf504750a0dac5dadbce219e4da
parent1255838f8d7640bb4cff9b02a1ae57a26a9de138
Bug 28785: Centralize cookie auth check in check_cookie_auth

This code is duplicated in 3 different places, we must call
check_cookie_auth instead.

It makes check_cookie_auth returns a 'restricted' when
SessionRestrictionByIP is set and the IP changed.
It also returns a third parameters contained the old and new IP, to fill
the "info" hash in checkauth but apparently the oldip and newip
variables are not even used from the template. We may want to remove it
completely.

No change is expected with this patch, the different authentication
methods should still work as before.

Test plan:
Log in the staff and OPAC interfaces, logout.
Log in and call script that call the 3 different subroutines modified by
this patch. For instance you can list checkouts (that is using
check_cookie_auth) and display a patron's image (using check_api_auth).

QA with good knowledge of the C4::Auth module and the different
authentication methods is required.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Auth.pm