Bug 33879: Do no longer overwrite interface in check_cookie_auth

This will only have effect on installations running OPAC and staff
on the same domain name. In that case an OPAC cookie still allows
you to access intranet, and v.v.

Test plan:
Repeat the following steps WITHOUT this patch and WITH it.
Login via OPAC.
Go to staff. Perform an action that logs the interface in e.g. the
statistics table, like a checkout.
Inspect interface in the corresponding table. Observe difference
that this patch makes.

With this patch:
Run t/db_dependent/Auth.t. Should pass again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Björn Nylén <bjorn.nylen@ub.lu.se>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 68aeaf5c4c)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Marcel de Rooy 2023-06-01 13:03:50 +00:00 committed by Martin Renvoize
parent 5377331f46
commit fdc49e0fb3
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -1789,7 +1789,10 @@ sub check_cookie_auth {
my $flags = defined($flagsrequired) ? haspermission( $userid, $flagsrequired ) : 1;
if ($flags) {
C4::Context->_new_userenv($sessionID);
C4::Context->interface($session->param('interface'));
if ( !C4::Context->interface ) {
# No need to override the interface, most often set by get_template_and_user
C4::Context->interface( $session->param('interface') );
}
C4::Context->set_userenv(
$session->param('number'), $session->param('id') // '',
$session->param('cardnumber'), $session->param('firstname'),