[ARVADOS] updated: 96e31a3c52a7d708ed571c3d6139b780efc1f7ce

git at public.curoverse.com git at public.curoverse.com
Thu Jun 19 22:18:53 EDT 2014


Summary of changes:
 apps/workbench/app/controllers/application_controller.rb | 10 ++++++++++
 apps/workbench/app/models/user.rb                        |  4 ----
 apps/workbench/app/views/layouts/application.html.erb    |  2 +-
 3 files changed, 11 insertions(+), 5 deletions(-)

       via  96e31a3c52a7d708ed571c3d6139b780efc1f7ce (commit)
      from  9b27fdf604f57fffed466c0899fd0dcf0e4f8768 (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 96e31a3c52a7d708ed571c3d6139b780efc1f7ce
Author: radhika <radhika at curoverse.com>
Date:   Thu Jun 19 22:17:35 2014 -0400

    2659: top-nav customization

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index e6e28c6..b7ec764 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -496,12 +496,16 @@ class ApplicationController < ActionController::Base
           is_admin: u.is_admin,
           prefs: u.prefs
         }
+        @@anonymous_user = u
       end
     elsif current_user && !current_user.andand.is_active
       previous_api_token = Thread.current[:arvados_api_token]
       if anonymous_user_token != previous_api_token
         Thread.current[:arvados_api_token] = anonymous_user_token
         valid_anonymous_token = verify_api_token
+        if valid_anonymous_token
+          @@anonymous_user = User.current
+        end
         Thread.current[:arvados_api_token] = previous_api_token
         verify_api_token
         if valid_anonymous_token
@@ -917,4 +921,10 @@ class ApplicationController < ActionController::Base
     @objects_for
   end
 
+  @@anonymous_user = nil
+  # helper method to create sharing link for anonymous user user
+  helper_method :is_anonymous
+  def is_anonymous user
+    return user.uuid == @@anonymous_user.andand.uuid
+  end
 end
diff --git a/apps/workbench/app/models/user.rb b/apps/workbench/app/models/user.rb
index 4a1a74d..9c91477 100644
--- a/apps/workbench/app/models/user.rb
+++ b/apps/workbench/app/models/user.rb
@@ -49,8 +49,4 @@ class User < ArvadosBase
     arvados_api_client.api(self, "/setup", params)
   end
 
-  def is_anonymous
-    Thread.current[:arvados_api_token] == Rails.configuration.anonymous_user_token
-  end
-
 end
diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb
index 93fe189..c50fe9a 100644
--- a/apps/workbench/app/views/layouts/application.html.erb
+++ b/apps/workbench/app/views/layouts/application.html.erb
@@ -77,7 +77,7 @@
           -->
 
           <% if current_user %>
-          <% if current_user && !current_user.is_anonymous %>
+          <% if current_user && !is_anonymous(current_user) %>
           <li class="dropdown notification-menu">
             <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="notifications-menu">
               <span class="badge badge-alert notification-count"><%= @notification_count %></span>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list