Commit 916b636e authored by Benjamin Rokseth's avatar Benjamin Rokseth
Browse files

koha: override C4::Auth::checkout for reserves

parent f2c84260
......@@ -67,16 +67,17 @@ sub Auth {
$auth or Deichman::Exception::Auth::InvalidSession->throw();
$session->put(auth => $auth);
}
use Data::Dumper; warn Dumper($session);
# decorate session with library, etc.
if ( my $userid = $session->param("userid") // $session->param("id") ) { # 'id' will be set for admin user as well
my $branchcode = $req->param("branch") || $auth->{branchcode};
try {
my $lib = Deichman::Library->new()->Get($branchcode)->{library};
$session->param(branchcode => $lib->{branchcode});
$session->param(branch => $lib->{branchcode});
$session->param(branchname => $lib->{branchname});
} catch {
warn $_->description;
$session->param(branchcode => "NO_LIBRARY_SET");
$session->param(branch => "NO_LIBRARY_SET");
$session->param(branchname => "NO_LIBRARY_SET");
};
......
......@@ -120,6 +120,7 @@ sub call {
}
return "failed";
};
local *{C4::Auth::checkauth} = sub { $session };
# TODO override all context methods?
local *{C4::Context::userenv} = sub { $session };
#local *{C4::Context::set_userenv} = sub { };
......
......@@ -36,7 +36,11 @@ use Koha::Patrons;
my $input = CGI->new();
checkauth($input, 0, { reserveforothers => 'place_holds' }, 'intranet');
#checkauth($input, 0, { reserveforothers => 'place_holds' }, 'intranet');
my ( $session ) = checkauth();
my $auth = $session->param("auth");
my $permissions = $auth->{permissions};
($permissions->{reserveforothers} || $permissions->{borrowers}) || print $input->redirect("mainpage.pl");
my @bibitems = $input->multi_param('biblioitem');
my @reqbib = $input->multi_param('reqbib');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment