Bugzilla – Attachment 62828 Details for
Bug 18442
Permission error when logging into staff interface as db user
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18442: Add a test
Bug-18442-Add-a-test.patch (text/plain), 2.21 KB, created by
Martin Renvoize (ashimema)
on 2017-04-28 14:48:33 UTC
(
hide
)
Description:
Bug 18442: Add a test
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2017-04-28 14:48:33 UTC
Size:
2.21 KB
patch
obsolete
>From 752720ca3f5f83ea784536aa77079a23adbf0f7f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 21 Apr 2017 18:44:05 -0300 >Subject: [PATCH] Bug 18442: Add a test > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Auth.pm | 1 + > t/db_dependent/Auth.t | 16 +++++++++++++++- > 2 files changed, 16 insertions(+), 1 deletion(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index fd4f79d..8a4166d 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -1021,6 +1021,7 @@ sub checkauth { > > # $return: 1 = valid user, 2 = superlibrarian > if ($return) { >+ # If DB user is logged in > $userid ||= $q_userid if $return == 2; > > #_session_log(sprintf "%20s from %16s logged in at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},(strftime '%c', localtime)); >diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t >index 705832d..b8f2b2e 100644 >--- a/t/db_dependent/Auth.t >+++ b/t/db_dependent/Auth.t >@@ -33,7 +33,7 @@ $schema->storage->txn_begin; > > subtest 'checkauth() tests' => sub { > >- plan tests => 1; >+ plan tests => 2; > > my $patron = $builder->build({ source => 'Borrower', value => { flags => undef } })->{userid}; > >@@ -47,6 +47,20 @@ subtest 'checkauth() tests' => sub { > > is( $userid, undef, 'checkauth() returns undef for userid if no logged in user (Bug 18275)' ); > >+ my $db_user_id = C4::Context->config('user'); >+ my $db_user_pass = C4::Context->config('pass'); >+ $cgi = Test::MockObject->new(); >+ $cgi->mock( 'cookie', sub { return; } ); >+ $cgi->mock( 'param', sub { >+ my ( $self, $param ) = @_; >+ if ( $param eq 'userid' ) { return $db_user_id; } >+ elsif ( $param eq 'password' ) { return $db_user_pass; } >+ else { return; } >+ }); >+ ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, $authnotrequired ); >+ is ( $userid, $db_user_id, 'If DB user is logging in, it should be considered as logged in, i.e. checkauth return the relevant userid' ); >+ C4::Context->_new_userenv; # For next tests >+ > }; > > my $hash1 = hash_password('password'); >-- >2.1.4
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 18442
:
62423
|
62448
|
62567
|
62710
|
62738
|
62739
|
62826
|
62827
| 62828