[open-ils-commits] [GIT] Evergreen ILS branch rel_2_8 updated. a83fae9a057befeb05846806ad95dd8d0fa14930

Evergreen Git git at git.evergreen-ils.org
Wed Aug 19 14:47:26 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_8 has been updated
       via  a83fae9a057befeb05846806ad95dd8d0fa14930 (commit)
       via  ffee9ede192344fbe27a866d3f4e4e2bd29ea742 (commit)
      from  d624339e821cfc6195d71cb142a1a7574ef1d911 (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 a83fae9a057befeb05846806ad95dd8d0fa14930
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 ffee9ede192344fbe27a866d3f4e4e2bd29ea742
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 bc08fe5..bdc78da 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
@@ -2869,12 +2869,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
     );
 
@@ -2890,14 +2891,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