Bugzilla – Attachment 143970 Details for
Bug 32208
Re-login without enough permissions needs attention
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32208: Extend Auth.t
Bug-32208-Extend-Autht.patch (text/plain), 3.19 KB, created by
Chris Cormack
on 2022-11-16 20:32:23 UTC
(
hide
)
Description:
Bug 32208: Extend Auth.t
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2022-11-16 20:32:23 UTC
Size:
3.19 KB
patch
obsolete
>From 17f74ec07d67319f2eeae7177900c534f5ad6b9e Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 15 Nov 2022 13:53:17 +0000 >Subject: [PATCH] Bug 32208: Extend Auth.t > >Test plan: >Without follow-up patch, Auth.t should fail: > not ok 5 - No permission response > not ok 6 - checkauth returned failure > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >--- > t/db_dependent/Auth.t | 29 ++++++++++++++++++++++++++--- > 1 file changed, 26 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t >index d26a927cad..d0ef2a60a2 100755 >--- a/t/db_dependent/Auth.t >+++ b/t/db_dependent/Auth.t >@@ -153,7 +153,8 @@ subtest 'checkauth() tests' => sub { > }; > > subtest 'While still logged in, relogin with another user' => sub { >- plan tests => 4; >+ plan tests => 6; >+ > my $patron = $builder->build_object({ class => 'Koha::Patrons', value => {} }); > my $patron2 = $builder->build_object({ class => 'Koha::Patrons', value => {} }); > # Create 'former' session >@@ -179,12 +180,11 @@ 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; >+ my ( @return, $stdout ); > { > local *STDOUT; > local %ENV; > $ENV{REMOTE_ADDR} = '1.2.3.4'; >- my $stdout; > open STDOUT, '>', \$stdout; > @return = C4::Auth::checkauth( $cgi, 0, {} ); > close STDOUT; >@@ -193,6 +193,29 @@ 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.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32208
:
143914
|
143915
|
143946
|
143947
| 143970 |
143971