[open-ils-commits] [GIT] Evergreen ILS branch rel_2_7 updated. 45dcc8299cb5dc807c443d70c2a3e33a5bb8e24e

Evergreen Git git at git.evergreen-ils.org
Wed Aug 19 14:48:33 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_2_7 has been updated
       via  45dcc8299cb5dc807c443d70c2a3e33a5bb8e24e (commit)
       via  a5c030f94bfbc2f63fb59921dc9fda9da2875305 (commit)
      from  c99a45667aeec97a0a0f06444dbd5ab50876ebd6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 45dcc8299cb5dc807c443d70c2a3e33a5bb8e24e
Author: Bill Erickson <berickxx at gmail.com>
Date:   Wed Aug 19 11:08:48 2015 -0400

    LP#1240119 safe auth activity live test
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>

diff --git a/Open-ILS/src/perlmods/live_t/11-lp1240119-safe-token-activity.t b/Open-ILS/src/perlmods/live_t/11-lp1240119-safe-token-activity.t
new file mode 100644
index 0000000..9909450
--- /dev/null
+++ b/Open-ILS/src/perlmods/live_t/11-lp1240119-safe-token-activity.t
@@ -0,0 +1,43 @@
+#!perl
+use strict; use warnings;
+use Test::More tests => 4;
+use OpenILS::Utils::TestUtils;
+use OpenILS::Utils::CStoreEditor qw/:funcs/;
+
+diag("Tests safe auth token user activity tracking");
+
+my $script = OpenILS::Utils::TestUtils->new();
+$script->bootstrap;
+
+my $e = new_editor();
+$e->init;
+
+$script->authenticate({
+    username => 'admin',
+    password => 'demo123',
+    type => 'staff'
+});
+
+ok($script->authtoken, 'Have an authtoken');
+
+my $actor_ses = $script->session('open-ils.actor');
+my $req = $actor_ses->request(
+    'open-ils.actor.session.safe_token', $script->authtoken);
+
+my $safe_token = $req->recv->content;
+
+ok($safe_token, 'Have safe token');
+
+my $act_count = scalar(@{$e->search_actor_usr_activity({usr => 1})});
+
+$req = $actor_ses->request(
+    'open-ils.actor.safe_token.home_lib.shortname', $safe_token);
+
+my $home_ou = $req->recv->content;
+
+ok($home_ou, 'Retrieved home org unit');
+
+my $act_count2 = scalar(@{$e->search_actor_usr_activity({usr => 1})});
+
+is($act_count2, $act_count + 1, 'User activity entry created');
+

commit a5c030f94bfbc2f63fb59921dc9fda9da2875305
Author: Bill Erickson <berick at esilibrary.com>
Date:   Mon Aug 19 09:24:17 2013 -0400

    LP#1240119 Safe auth token activity logging
    
    Expand safe token generation to include user ID in the cached data,
    which can be retrieved later for activity logging.  Add activity logging
    directly to the open-ils.actor.safe_token.home_lib.shortname API.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Josh Stompro <stomproj at larl.org>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
index ceaeaac..26b86d4 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
@@ -2830,12 +2830,13 @@ sub session_safe_token {
 
     $cache ||= OpenSRF::Utils::Cache->new("global", 0);
 
-    # Add more like the following if needed...
+    # add more user fields as needed
     $cache->put_cache(
-        "safe-token-home_lib-shortname-$safe_token",
-        $e->retrieve_actor_org_unit(
-            $e->requestor->home_ou
-        )->shortname,
+        "safe-token-user-$safe_token", {   
+            id => $e->requestor->id, 
+            home_ou_shortname => $e->retrieve_actor_org_unit(
+                $e->requestor->home_ou)->shortname,
+        },
         60 * 60
     );
 
@@ -2851,14 +2852,19 @@ __PACKAGE__->register_method(
         asscociated with a safe token from generated by
         open-ils.actor.session.safe_token.
         @param safe_token Active safe token
+        @param who Optional user activity "ewho" value
     /
 );
 
 sub safe_token_home_lib {
-    my( $self, $conn, $safe_token ) = @_;
-
+    my( $self, $conn, $safe_token, $who ) = @_;
     $cache ||= OpenSRF::Utils::Cache->new("global", 0);
-    return $cache->get_cache( 'safe-token-home_lib-shortname-'. $safe_token );
+
+    my $blob = $cache->get_cache("safe-token-user-$safe_token");
+    return unless $blob;
+
+    $U->log_user_activity($blob->{id}, $who, 'verify');
+    return $blob->{home_ou_shortname};
 }
 
 

-----------------------------------------------------------------------

Summary of changes:
 .../src/perlmods/lib/OpenILS/Application/Actor.pm  |   22 ++++++----
 .../live_t/11-lp1240119-safe-token-activity.t      |   43 ++++++++++++++++++++
 2 files changed, 57 insertions(+), 8 deletions(-)
 create mode 100644 Open-ILS/src/perlmods/live_t/11-lp1240119-safe-token-activity.t


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list