|
Lines 374-380
subtest 'checkauth() tests' => sub {
Link Here
|
| 374 |
|
374 |
|
| 375 |
subtest 'loggedinlibrary permission tests' => sub { |
375 |
subtest 'loggedinlibrary permission tests' => sub { |
| 376 |
|
376 |
|
| 377 |
plan tests => 3; |
377 |
plan tests => 5; |
| 378 |
my $staff_user = $builder->build_object( |
378 |
my $staff_user = $builder->build_object( |
| 379 |
{ class => 'Koha::Patrons', value => { flags => 536870916 } } ); |
379 |
{ class => 'Koha::Patrons', value => { flags => 536870916 } } ); |
| 380 |
|
380 |
|
|
Lines 411-416
subtest 'checkauth() tests' => sub {
Link Here
|
| 411 |
$sesh = C4::Auth::get_session($sessionID); |
411 |
$sesh = C4::Auth::get_session($sessionID); |
| 412 |
is( $sesh->param('branch'), $branch->branchcode, "If user is superlibrarian, they should be able to choose a branch" ); |
412 |
is( $sesh->param('branch'), $branch->branchcode, "If user is superlibrarian, they should be able to choose a branch" ); |
| 413 |
|
413 |
|
|
|
414 |
t::lib::Mocks::mock_preference( 'AutoLocation', 1 ); |
| 415 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired' ); |
| 416 |
is( $userid, undef, "Library user at ip not in branch should not be logged in under AutoLocation" ); |
| 417 |
|
| 418 |
$staff_user->branchcode($branch->branchcode)->store->discard_changes; |
| 419 |
$branch->branchip($ENV{REMOTE_ADDR})->store->discard_changes; |
| 420 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired' ); |
| 421 |
is( $userid, $staff_user->userid, "Library user at ip in branch should be logged in under AutoLocation" ); |
| 414 |
}; |
422 |
}; |
| 415 |
C4::Context->_new_userenv; # For next tests |
423 |
C4::Context->_new_userenv; # For next tests |
| 416 |
}; |
424 |
}; |
| 417 |
- |
|
|