From 51b9bd01c435babf0eda0e6ee351da80df7d73b7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 14 Feb 2011 13:03:24 -0500 Subject: [PATCH] updated cstoreditor to fetch full cached object to get the authtime; capturing authtime in the web context --- .../lib/OpenILS/Utils/CStoreEditor.pm | 22 +++++++++++++++---- .../perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 4 ++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm index ff298f42d1..03237caf3a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm @@ -115,11 +115,19 @@ sub log { sub checkauth { my $self = shift; $self->log(D, "checking auth token ".$self->authtoken); - my ($reqr, $evt) = $U->checkses($self->authtoken); - $self->event($evt) if $evt; - return $self->{requestor} = $reqr; -} + my $content = $U->simplereq( + 'open-ils.auth', + 'open-ils.auth.session.retrieve', $self->authtoken, 1); + + if(!$content or $U->event_code($content)) { + $self->event( ($content) ? $content : OpenILS::Event->new('NO_SESSION')); + return undef; + } + + $self->{authtime} = $content->{authtime}; + return $self->{requestor} = $content->{userobj}; +} =head test sub checkauth { @@ -177,6 +185,12 @@ sub authtoken { return $self->{authtoken}; } +sub authtime { + my( $self, $auth ) = @_; + $self->{authtime} = $auth if $auth; + return $self->{authtime}; +} + sub timeout { my($self, $to) = @_; $self->{timeout} = $to if defined $to; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 99df8e7505..89d616b0bd 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -144,8 +144,12 @@ sub load_common { if($e->checkauth) { + $self->apache->log->warn("authtime = " . $e->authtime); + $ctx->{authtoken} = $e->authtoken; + $ctx->{authtime} = $e->authtime; $ctx->{user} = $e->requestor; + $ctx->{user_stats} = $U->simplereq( 'open-ils.actor', 'open-ils.actor.user.opac.vital_stats', -- 2.43.2