From f4c3e205857cc2a23f847f69b07385b8c27938f0 Mon Sep 17 00:00:00 2001
From: Jason Stephenson <jstephenson@mvlc.org>
Date: Mon, 31 Oct 2011 16:36:27 -0400
Subject: [PATCH] OpenILS::Utils::Cronscript can have only 1 session.

Work around the above limitation by using OpenSRF::AppSession
to create a session for open-ils.auth in the authenticate method.

Also requires us to manually check if we're bootstrapped, since
we can't rely on OpenILS::Utils::Cronscript->session to do it for
us.

Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
---
 Open-ILS/src/perlmods/lib/OpenILS/Utils/Cronscript.pm.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Cronscript.pm.in b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Cronscript.pm.in
index 9e5e8e59cc..cb0c8603a8 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Cronscript.pm.in
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Cronscript.pm.in
@@ -300,7 +300,8 @@ sub authenticate {
     my $self = shift or return;
     my $args = shift or return;
     if ($args && ref($args) eq 'HASH') {
-        my $session = $self->session('open-ils.auth');
+        $self->{bootstrapped}  or $self->bootstrap();
+        my $session = Opensrf::AppSession->create('open-ils.auth');
         my $seed = $session->request('open-ils.auth.authenticate.init',
                                     $args->{'username'})->gather(1);
         $args->{password} = md5_hex($seed . md5_hex($args->{password}));
-- 
2.11.0