[ARVADOS] updated: e27463ce59b16bb4e0392cba50d7ab894f73cbdf

git at public.curoverse.com git at public.curoverse.com
Sun Jun 15 10:16:01 EDT 2014


Summary of changes:
 .../app/views/pipeline_instances/show.html.erb     |  8 +--
 .../test/integration/pipeline_instances_test.rb    | 68 +++++++++++++++++++++-
 .../test/fixtures/api_client_authorizations.yml    |  7 +++
 services/api/test/fixtures/users.yml               |  5 +-
 4 files changed, 79 insertions(+), 9 deletions(-)

       via  e27463ce59b16bb4e0392cba50d7ab894f73cbdf (commit)
       via  5b2024f4a1e8e5002c96a630f1426cbef9d0a9f5 (commit)
       via  441f7e1c62df70e73f508bec5ed2e71fd8ab79f7 (commit)
      from  0724402caada5dda76c779a16a02432640c32a56 (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 e27463ce59b16bb4e0392cba50d7ab894f73cbdf
Author: radhika <radhika at curoverse.com>
Date:   Sun Jun 15 10:15:36 2014 -0400

    2659: integration test for anonymous user access

diff --git a/apps/workbench/app/views/pipeline_instances/show.html.erb b/apps/workbench/app/views/pipeline_instances/show.html.erb
index b4cbaa4..7394267 100644
--- a/apps/workbench/app/views/pipeline_instances/show.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/show.html.erb
@@ -12,6 +12,7 @@
 <% end %>
 
 <% content_for :tab_line_buttons do %>
+  <% if current_user.andand.can_act? %>
   <%= link_to(copy_pipeline_instance_path('id' => @object.uuid, 'pipeline_instance[state]' => 'New'),
       class: 'btn btn-primary',
       #data: {toggle: :tooltip, placement: :top}, title: 'copy and modify',
@@ -27,31 +28,26 @@
         class: 'btn btn-primary run-pipeline-button',
         method: :patch
         ) do %>
-      <% if current_user.andand.can_act? %>
       Run <i class="fa fa-fw fa-play"></i>
       <% end %>
-    <% end %>
   <% else %>
     <% if @object.state.in? ['RunningOnClient', 'RunningOnServer'] %>
       <%= link_to(url_for('pipeline_instance[state]' => 'Paused'),
           class: 'btn btn-primary run-pipeline-button',
           method: :patch
           ) do %>
-        <% if current_user.andand.can_act? %>
         Stop <i class="fa fa-fw fa-stop"></i>
-        <% end %>
       <% end %>
     <% elsif @object.state == 'Paused' %>
       <%= link_to(url_for('pipeline_instance[state]' => 'RunningOnServer'),
           class: 'btn btn-primary run-pipeline-button',
           method: :patch
           ) do %>
-        <% if current_user.andand.can_act? %>
         Resume <i class="fa fa-fw fa-play"></i>
-        <% end %>
       <% end %>
     <% end %>
   <% end %>
+  <% end %>
 <% end %>
 
 <% if @object.state.in? %w(RunningOnServer RunningOnClient) %>
diff --git a/apps/workbench/test/integration/pipeline_instances_test.rb b/apps/workbench/test/integration/pipeline_instances_test.rb
index da4aa1a..47e2b51 100644
--- a/apps/workbench/test/integration/pipeline_instances_test.rb
+++ b/apps/workbench/test/integration/pipeline_instances_test.rb
@@ -97,7 +97,7 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
     find('#persistent-selection-count').click
 
     # Add this collection to the project using collections menu from top nav
-    visit '/projects'
+    visit '/'
     find('.arv-project-list a,button', text: 'A Project').click
 
     find('li.selection-menu > a').click
@@ -168,6 +168,9 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
     assert page.has_text? 'Projects shared with me'
     assert page.has_no_text? 'A Project'
 
+    find('.arv-project-list a,button', text: 'Unrestricted public data').click
+    page.has_text? ('An anonymously accessible project')
+
     find('a', text: 'Projects').click
     within('.dropdown-menu') do
       page.has_no_text? ('New project')
@@ -183,6 +186,7 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
     visit page_with_token('anonymous')
     assert page.has_text? 'A Project'
     find('a', text: 'A Project').click
+    page.has_text? ('Test project belonging to active user')
 
     #find('tr[data-kind="arvados#pipelineInstance"]', text: 'New pipeline instance').
     #  find('a', text: 'Show').click
@@ -197,8 +201,15 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
     assert page.has_no_text? 'A Project'
 
     # as active user "A Project" is accessible
-    visit page_with_token('active_trustedclient')
+    visit page_with_token('active')
     assert page.has_text? 'A Project'
+    find('.arv-project-list a,button', text: 'Unrestricted public data').click
+    page.has_text? ('An anonymously accessible project')
+    find('a', text: 'Projects').click
+    within('.dropdown-menu') do
+      page.has_text? ('New project')
+      page.has_text? ('Projects shared with me')
+    end
   end
 
 end
diff --git a/services/api/test/fixtures/api_client_authorizations.yml b/services/api/test/fixtures/api_client_authorizations.yml
index efbfe75..d1743b7 100644
--- a/services/api/test/fixtures/api_client_authorizations.yml
+++ b/services/api/test/fixtures/api_client_authorizations.yml
@@ -142,3 +142,4 @@ anonymous:
   user: anonymous
   api_token: 4kg6k6lzmp9kj4cpkcoxie964cmvjahbt4fod9zru44k4jqdmi
   expires_at: 2038-01-01 00:00:00
+  scopes: ["GET /"]

commit 5b2024f4a1e8e5002c96a630f1426cbef9d0a9f5
Author: radhika <radhika at curoverse.com>
Date:   Sat Jun 14 18:20:13 2014 -0400

    2659: add test for anonymous user visiting a shared folder

diff --git a/apps/workbench/test/integration/pipeline_instances_test.rb b/apps/workbench/test/integration/pipeline_instances_test.rb
index ec2bf95..da4aa1a 100644
--- a/apps/workbench/test/integration/pipeline_instances_test.rb
+++ b/apps/workbench/test/integration/pipeline_instances_test.rb
@@ -150,4 +150,55 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
     assert page.has_text? 'script_version'
   end
 
+  # Visit project as anonymous user and verify that pipeline cannot be modified
+  test 'visit shared project as anonymous user' do
+    add_a_collection_and_pipeline_to_project
+
+    # login as anonymous user and verify that top nav
+    visit page_with_token('anonymous')
+    
+    within('.navbar-fixed-top') do
+      assert page.has_text? 'You are viewing public data'
+      assert page.has_link? 'Log in'
+    end
+
+    assert page.has_text? 'Welcome'
+    assert page.has_no_text? 'My projects'
+    assert page.has_no_button? 'Add new project'
+    assert page.has_text? 'Projects shared with me'
+    assert page.has_no_text? 'A Project'
+
+    find('a', text: 'Projects').click
+    within('.dropdown-menu') do
+      page.has_no_text? ('New project')
+      page.has_text? ('Projects shared with me')
+    end
+
+    # share "A Project" with anonymous users
+    use_token :admin
+    ac = ApplicationController.new
+    ac.send :share_with_anonymous_group, api_fixture('groups')['aproject']['uuid']
+
+    # as anonymous user verify the shared project is accessible
+    visit page_with_token('anonymous')
+    assert page.has_text? 'A Project'
+    find('a', text: 'A Project').click
+
+    #find('tr[data-kind="arvados#pipelineInstance"]', text: 'New pipeline instance').
+    #  find('a', text: 'Show').click
+
+    # unshare "A Project" with anonymous users
+    use_token :admin
+    ac = ApplicationController.new
+    ac.send :unshare_with_anonymous_group, api_fixture('groups')['aproject']['uuid']
+
+    # as anonymous user verify the project is no longer shared
+    visit page_with_token('anonymous')
+    assert page.has_no_text? 'A Project'
+
+    # as active user "A Project" is accessible
+    visit page_with_token('active_trustedclient')
+    assert page.has_text? 'A Project'
+  end
+
 end
diff --git a/services/api/test/fixtures/api_client_authorizations.yml b/services/api/test/fixtures/api_client_authorizations.yml
index 71b6388..efbfe75 100644
--- a/services/api/test/fixtures/api_client_authorizations.yml
+++ b/services/api/test/fixtures/api_client_authorizations.yml
@@ -136,3 +136,9 @@ valid_token_deleted_user:
   user_id: 1234567
   api_token: tewfa58099sndckyqhlgd37za6e47o6h03r9l1vpll23hudm8b
   expires_at: 2038-01-01 00:00:00
+
+anonymous:
+  api_client: untrusted
+  user: anonymous
+  api_token: 4kg6k6lzmp9kj4cpkcoxie964cmvjahbt4fod9zru44k4jqdmi
+  expires_at: 2038-01-01 00:00:00
diff --git a/services/api/test/fixtures/users.yml b/services/api/test/fixtures/users.yml
index 80ab5ed..55ccef5 100644
--- a/services/api/test/fixtures/users.yml
+++ b/services/api/test/fixtures/users.yml
@@ -82,8 +82,9 @@ inactive_but_signed_user_agreement:
 
 anonymous:
   uuid: zzzzz-tpzed-anonymouspublic
-  first_name: anonymous
-  last_name: anonymous
+  email: anonymouspublic
+  first_name: anonymouspublic
+  last_name: anonymouspublic
   is_active: true
   is_admin: false
   prefs: {}

commit 441f7e1c62df70e73f508bec5ed2e71fd8ab79f7
Author: radhika <radhika at curoverse.com>
Date:   Sat Jun 14 11:59:34 2014 -0400

    2659: refactor pipeline in a folder test to facilitate reusing with anonymous user testing

diff --git a/apps/workbench/test/integration/pipeline_instances_test.rb b/apps/workbench/test/integration/pipeline_instances_test.rb
index a85fd99..ec2bf95 100644
--- a/apps/workbench/test/integration/pipeline_instances_test.rb
+++ b/apps/workbench/test/integration/pipeline_instances_test.rb
@@ -83,6 +83,10 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
 
   # Create a pipeline instance from within a project and run
   test 'Create pipeline inside a project and run' do
+    add_a_collection_and_pipeline_to_project
+  end
+
+  def add_a_collection_and_pipeline_to_project
     visit page_with_token('active_trustedclient')
 
     # Go over to the collections page and select something

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list