From 2eb1c842b17ff00bd86e7b55f04716813fab5d2d Mon Sep 17 00:00:00 2001 From: Wainui Witika-Park Date: Fri, 20 Jan 2023 15:42:59 +1300 Subject: [PATCH] Revert "Bug 32208: Extend Auth.t" This reverts commit adc9fd4fd8fe2e2009a40e4b85af0febbc5fdedc. --- t/db_dependent/Auth.t | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t index 68d7543d82..9e013bb1c4 100755 --- a/t/db_dependent/Auth.t +++ b/t/db_dependent/Auth.t @@ -150,8 +150,7 @@ subtest 'checkauth() tests' => sub { }; subtest 'While still logged in, relogin with another user' => sub { - plan tests => 6; - + plan tests => 4; my $patron = $builder->build_object({ class => 'Koha::Patrons', value => {} }); my $patron2 = $builder->build_object({ class => 'Koha::Patrons', value => {} }); # Create 'former' session @@ -177,11 +176,12 @@ subtest 'checkauth() tests' => sub { $cgi->param( -name => 'userid', -value => $patron2->userid ); $cgi->param( -name => 'password', -value => $password ); $cgi->param( -name => 'koha_login_context', -value => 1 ); - my ( @return, $stdout ); + my @return; { local *STDOUT; local %ENV; $ENV{REMOTE_ADDR} = '1.2.3.4'; + my $stdout; open STDOUT, '>', \$stdout; @return = C4::Auth::checkauth( $cgi, 0, {} ); close STDOUT; @@ -190,29 +190,6 @@ subtest 'checkauth() tests' => sub { is( $return[0], $patron2->userid, 'Login of patron2 approved' ); isnt( $return[2], $sessionID, 'Did not return previous session ID' ); ok( $return[2], 'New session ID not empty' ); - - # Similar situation: Relogin with former session of $patron, new user $patron2 has no permissions - $patron2->flags(undef)->store; - $session->param( 'number', $patron->id ); - $session->param( 'id', $patron->userid ); - $session->param( 'interface', 'intranet' ); - $session->flush; - $sessionID = $session->id; - C4::Context->_new_userenv($sessionID); - $cgi->param( -name => 'userid', -value => $patron2->userid ); - $cgi->param( -name => 'password', -value => $password ); - $cgi->param( -name => 'koha_login_context', -value => 1 ); - { - local *STDOUT; - local %ENV; - $ENV{REMOTE_ADDR} = '1.2.3.4'; - $stdout = q{}; - open STDOUT, '>', \$stdout; - @return = C4::Auth::checkauth( $cgi, 0, { catalogue => 1 }, 'intranet' ); # patron2 has no catalogue perm - close STDOUT; - } - like( $stdout, qr/You do not have permission to access this page/, 'No permission response' ); - is( @return, 0, 'checkauth returned failure' ); }; subtest 'Two-factor authentication' => sub { -- 2.39.5