[ARVADOS] updated: 33e6d3356af3f7eaa484dbaa7a671aa25f5042e4

git at public.curoverse.com git at public.curoverse.com
Mon Feb 2 22:40:39 EST 2015


Summary of changes:
 .../app/controllers/collections_controller.rb      |  9 ++++-
 apps/workbench/app/controllers/jobs_controller.rb  |  4 +-
 .../controllers/pipeline_instances_controller.rb   |  4 +-
 .../controllers/pipeline_templates_controller.rb   |  4 +-
 .../app/controllers/projects_controller.rb         |  4 +-
 .../controllers/application_controller_test.rb     | 34 +++++++++++++++++
 doc/sdk/cli/index.html.textile.liquid              | 44 +++++++++++++++++++++-
 doc/sdk/cli/reference.html.textile.liquid          | 13 +------
 8 files changed, 97 insertions(+), 19 deletions(-)

       via  33e6d3356af3f7eaa484dbaa7a671aa25f5042e4 (commit)
       via  03428065459077f94f44c53573944f22bda63779 (commit)
       via  89fb910b523686fdf725691c44cb4c63ba464487 (commit)
      from  9a6559f936fb93f63e163690be4ed670a76dd135 (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 33e6d3356af3f7eaa484dbaa7a671aa25f5042e4
Merge: 0342806 89fb910
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Mon Feb 2 22:40:29 2015 -0500

    Merge branch 'master' into 2659-anonymous-share-projects


commit 03428065459077f94f44c53573944f22bda63779
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Mon Feb 2 22:39:34 2015 -0500

    2659: skip require_thread_api_token filter only when anonymous config enabled.

diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index 85ea47d..36c214c 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -3,8 +3,13 @@ require "arvados/keep"
 class CollectionsController < ApplicationController
   include ActionController::Live
 
-  skip_around_filter(:require_thread_api_token,
-                     only: [:show_file, :show_file_links, :show])
+  if Rails.configuration.anonymous_user_token
+    skip_around_filter(:require_thread_api_token,
+                       only: [:show_file, :show_file_links, :show])
+  else
+    skip_around_filter(:require_thread_api_token,
+                       only: [:show_file, :show_file_links])
+  end
   skip_before_filter(:find_object_by_uuid,
                      only: [:provenance, :show_file, :show_file_links])
   # We depend on show_file to display the user agreement:
diff --git a/apps/workbench/app/controllers/jobs_controller.rb b/apps/workbench/app/controllers/jobs_controller.rb
index a85a70b..9090d64 100644
--- a/apps/workbench/app/controllers/jobs_controller.rb
+++ b/apps/workbench/app/controllers/jobs_controller.rb
@@ -1,5 +1,7 @@
 class JobsController < ApplicationController
-  skip_around_filter :require_thread_api_token, only: :show
+  if Rails.configuration.anonymous_user_token
+    skip_around_filter :require_thread_api_token, only: :show
+  end
 
   include JobsHelper
 
diff --git a/apps/workbench/app/controllers/pipeline_instances_controller.rb b/apps/workbench/app/controllers/pipeline_instances_controller.rb
index 231f923..2f875ed 100644
--- a/apps/workbench/app/controllers/pipeline_instances_controller.rb
+++ b/apps/workbench/app/controllers/pipeline_instances_controller.rb
@@ -1,7 +1,9 @@
 class PipelineInstancesController < ApplicationController
   skip_before_filter :find_object_by_uuid, only: :compare
   before_filter :find_objects_by_uuid, only: :compare
-  skip_around_filter :require_thread_api_token, only: :show
+  if Rails.configuration.anonymous_user_token
+    skip_around_filter :require_thread_api_token, only: :show
+  end
 
   include PipelineInstancesHelper
   include PipelineComponentsHelper
diff --git a/apps/workbench/app/controllers/pipeline_templates_controller.rb b/apps/workbench/app/controllers/pipeline_templates_controller.rb
index cf84aef..eb5f379 100644
--- a/apps/workbench/app/controllers/pipeline_templates_controller.rb
+++ b/apps/workbench/app/controllers/pipeline_templates_controller.rb
@@ -1,5 +1,7 @@
 class PipelineTemplatesController < ApplicationController
-  skip_around_filter :require_thread_api_token, only: :show
+  if Rails.configuration.anonymous_user_token
+    skip_around_filter :require_thread_api_token, only: :show
+  end
 
   include PipelineComponentsHelper
 
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index 9783951..d0c5f8c 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -1,6 +1,8 @@
 class ProjectsController < ApplicationController
   before_filter :set_share_links, if: -> { defined? @object }
-  skip_around_filter :require_thread_api_token, only: [:show, :tab_counts]
+  if Rails.configuration.anonymous_user_token
+    skip_around_filter :require_thread_api_token, only: [:show, :tab_counts]
+  end
 
   def model_class
     Group
diff --git a/apps/workbench/test/controllers/application_controller_test.rb b/apps/workbench/test/controllers/application_controller_test.rb
index d0d9c5d..30da596 100644
--- a/apps/workbench/test/controllers/application_controller_test.rb
+++ b/apps/workbench/test/controllers/application_controller_test.rb
@@ -325,4 +325,38 @@ class ApplicationControllerTest < ActionController::TestCase
       Rails.configuration.arvados_v1_base = orig_api_server
     end
   end
+
+  [
+    ['collections', false, api_fixture('collections')['user_agreement_in_anonymously_accessible_project']],
+    ['jobs', false, api_fixture('jobs')['running_job_in_publicly_accessible_project']],
+    ['pipeline_instances', false, api_fixture('pipeline_instances')['pipeline_in_publicly_accessible_project']],
+    ['pipeline_templates', false, api_fixture('pipeline_templates')['pipeline_template_in_publicly_accessible_project']],
+    ['projects', false, api_fixture('groups')['anonymously_accessible_project']],
+  ].each do |controller, use_config, fixture|
+    test "#{controller} show method with anonymous config enabled #{use_config}" do
+      if use_config
+        Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
+      else
+        Rails.configuration.anonymous_user_token = false
+      end
+
+      case controller
+      when 'collections'
+        @controller = CollectionsController.new
+      when 'jobs'
+        @controller = JobsController.new
+      when 'pipeline_instances'
+        @controller = PipelineInstancesController.new
+      when 'pipeline_templates'
+        @controller = PipelineTemplatesController.new
+      when 'projects'
+        @controller = ProjectsController.new
+      end
+
+      get(:show, {id: fixture['uuid']})
+
+      assert_response :redirect
+      assert_match /welcome/, @response.redirect_url
+    end
+  end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list