From 2ef1d26cff517c73b467675418e7ce512fd6432b Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 31 Aug 2006 22:23:11 +0000 Subject: [PATCH 1/1] added logic which makes the server re-login on auth session timeout git-svn-id: svn://svn.open-ils.org/ILS/trunk@5820 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/SIP.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Open-ILS/src/perlmods/OpenILS/SIP.pm b/Open-ILS/src/perlmods/OpenILS/SIP.pm index 09c1effd4a..4cea63e96b 100644 --- a/Open-ILS/src/perlmods/OpenILS/SIP.pm +++ b/Open-ILS/src/perlmods/OpenILS/SIP.pm @@ -32,6 +32,8 @@ sub new { my $type = ref($class) || $class; my $self = {}; + $self->{login} = $login; + $config = $institution; syslog("LOG_DEBUG", "OILS: new ILS '%s'", $institution->{id}); $self->{institution} = $institution; @@ -56,6 +58,16 @@ sub new { return $self; } +sub verify_session { + my $self = shift; + my $ses = $U->simplereq( + 'open-ils.auth', + 'open-ils.auth.session.retrieve', $self->{authtoken} ); + return 1 unless $U->event_code($ses); + syslog('LOG_INFO', "OILS: Logging back after session timeout as user ".$self->{login}->{id}); + return $self->login( $self->{login}->{id}, $self->{login}->{password} ); +} + sub to_bool { my $val = shift; return ($val and $val =~ /true/io); @@ -208,6 +220,8 @@ sub offline_ok { sub checkout { my ($self, $patron_id, $item_id, $sc_renew) = @_; + + $self->verify_session; syslog('LOG_DEBUG', "OILS: OpenILS::Checkout attempt: patron=$patron_id, item=$item_id"); @@ -266,6 +280,8 @@ sub checkin { my ($self, $item_id, $trans_date, $return_date, $current_loc, $item_props, $cancel) = @_; + $self->verify_session; + syslog('LOG_DEBUG', "OILS: OpenILS::Checkin on item=$item_id"); my $patron; @@ -488,6 +504,8 @@ sub renew { my ($self, $patron_id, $patron_pwd, $item_id, $title_id, $no_block, $nb_due_date, $third_party, $item_props, $fee_ack) = @_; + $self->verify_session; + my $trans = OpenILS::SIP::Transaction::Renew->new( authtoken => $self->{authtoken} ); $trans->patron($self->find_patron($patron_id)); $trans->item($self->find_item($item_id)); -- 2.43.2