[ARVADOS] updated: 987b88a5441387ff91877464def7933064815b59

git at public.curoverse.com git at public.curoverse.com
Mon Jun 9 09:09:13 EDT 2014


Summary of changes:
 .../app/controllers/application_controller.rb       | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

       via  987b88a5441387ff91877464def7933064815b59 (commit)
      from  626db8559ebaa13df19dafe9bb03b1bd484b762c (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.


commit 987b88a5441387ff91877464def7933064815b59
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Jun 9 09:09:09 2014 -0400

    2961: Save user information as part of the session cookie, eliminates looking
    up current user when rendering every page and panel, this means 2x reduction in
    latency when the panel only requires 1 API lookup otherwise.

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index fa1b8fa..d225b6e 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -180,8 +180,18 @@ class ApplicationController < ActionController::Base
   end
 
   def current_user
+    return Thread.current[:user] if Thread.current[:user]
+
     if Thread.current[:arvados_api_token]
-      Thread.current[:user] ||= User.current
+      if session[:user]
+        if session[:user][:is_active] != true
+          Thread.current[:user] = User.current
+        else
+          Thread.current[:user] = User.new(session[:user])
+        end
+      else
+        Thread.current[:user] = User.current
+      end
     else
       logger.error "No API token in Thread"
       return nil
@@ -275,6 +285,15 @@ class ApplicationController < ActionController::Base
         # call to verify its authenticity.
         if verify_api_token
           session[:arvados_api_token] = params[:api_token]
+          u = User.current
+          session[:user] = {
+            email: u.email,
+            first_name: u.first_name,
+            last_name: u.last_name,
+            is_active: u.is_active,
+            is_admin: u.is_admin,
+            prefs: u.prefs
+          }
           if !request.format.json? and request.method == 'GET'
             # Repeat this request with api_token in the (new) session
             # cookie instead of the query string.  This prevents API

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list