From bf47b719a05c667226e5449ed54c316e10f781a8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 17 Feb 2020 13:16:48 +0100 Subject: [PATCH] Bug 24663: [19.05.x] Test OpacPublic for all OPAC scripts Prior to this patchset there were 3 different calls to get_template_and_user (or checkauth) with the authnotrequired param: * authnotrequired => 0 * authnotrequired => 1 * authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ) The first one says that an unauthenticated user can access the page, the second that the user has to be authenticated, and the last one that it depends on the OpacPublic syspref. Actually we must replace the first one with the third one, if the OPAC is not public, the authentication must be forced. To do so we are going to remove the "authnotrequired => 0" occurrences, and check the OpacPublic syspref's value in C4::Auth Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi Signed-off-by: Victor Grousset/tuxayo --- C4/Auth.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/C4/Auth.pm b/C4/Auth.pm index fa3b14e6e6..412d5dad5d 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -791,6 +791,7 @@ sub checkauth { my $emailaddress = shift; $type = 'opac' unless $type; + $authnotrequired = 0 unless C4::Context->preference("OpacPublic"); my $dbh = C4::Context->dbh; my $timeout = _timeout_syspref(); -- 2.39.5