[ARVADOS] updated: dc96093e6a9d30699ea06d65ebe1ffe6d59977b9

git at public.curoverse.com git at public.curoverse.com
Thu Apr 16 13:37:58 EDT 2015


Summary of changes:
 .../controllers/pipeline_instances_controller.rb   |  2 +-
 apps/workbench/app/helpers/application_helper.rb   | 23 ++++++++++++++--------
 .../app/helpers/pipeline_instances_helper.rb       |  4 ++--
 .../test/integration/anonymous_access_test.rb      |  1 +
 services/api/test/fixtures/pipeline_instances.yml  | 17 ++++++++++++++++
 5 files changed, 36 insertions(+), 11 deletions(-)

       via  dc96093e6a9d30699ea06d65ebe1ffe6d59977b9 (commit)
      from  0b1d679afec2976ee170692f4178fdc28eb25a04 (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 dc96093e6a9d30699ea06d65ebe1ffe6d59977b9
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Thu Apr 16 13:35:58 2015 -0400

    5417: a few changes from based on review feedback. also, account for dataclass=File type when checking if input is readable by current user.

diff --git a/apps/workbench/app/controllers/pipeline_instances_controller.rb b/apps/workbench/app/controllers/pipeline_instances_controller.rb
index 4a7348a..57deee4 100644
--- a/apps/workbench/app/controllers/pipeline_instances_controller.rb
+++ b/apps/workbench/app/controllers/pipeline_instances_controller.rb
@@ -295,7 +295,7 @@ class PipelineInstancesController < ApplicationController
     @object.components.each do |k, component|
       next if !component
       component[:script_parameters].andand.each do |p, tv|
-        if (tv.is_a? Hash) and (tv[:dataclass] == "Collection")
+        if (tv.is_a? Hash) and ((tv[:dataclass] == "Collection") || (tv[:dataclass] == "File"))
           if tv[:value]
             value = tv[:value]
           elsif tv[:default]
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index 4af7d29..923a366 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -187,28 +187,35 @@ module ApplicationHelper
     if readable
       link_to_if_arvados_object attrvalue, opts
     elsif opts[:required] and current_user # no need to show this for anonymous user
-      raw('<div><input type="text" style="border:none;width:100%;background:#ffdddd" disabled=true class="required unreadable-input" value="' + link_text_if_not_readable + '" ></input></div>')
+      raw('<div><input type="text" style="border:none;width:100%;background:#ffdddd" disabled=true class="required unreadable-input" value="') + link_text_if_not_readable + raw('" ></input></div>')
     else
       link_text_if_not_readable
     end
   end
 
+  # This method takes advantage of preloaded collections and objects.
+  # Hence you can improve performance by first preloading objects
+  # related to the page context before using this method.
   def object_readable attrvalue, resource_class=nil
-    # if it is a collection filename, check readable for the locator
-    attrvalue = attrvalue.split('/')[0] if attrvalue
-
-    resource_class = resource_class_for_uuid(attrvalue)
+    resource_class = resource_class_for_uuid(attrvalue) if resource_class.nil?
     return if resource_class.nil?
 
+    return_value = nil
     if resource_class.to_s == 'Collection'
+      # if it is a collection filename, check readable for the locator
+      attrvalue = attrvalue.split('/')[0] if attrvalue
+
       if CollectionsHelper.match(attrvalue)
-        collection_for_pdh(attrvalue).any?
+        found = collection_for_pdh(attrvalue)
+        return_value = found.first if found.any?
       else
-        collections_for_object(attrvalue).any?
+        found = collections_for_object(attrvalue)
+        return_value = found.first if found.any?
       end
     else
-      object_for_dataclass(resource_class, attrvalue)
+      return_value = object_for_dataclass(resource_class, attrvalue)
     end
+    return_value
   end
 
   def render_editable_attribute(object, attr, attrvalue=nil, htmloptions={})
diff --git a/apps/workbench/app/helpers/pipeline_instances_helper.rb b/apps/workbench/app/helpers/pipeline_instances_helper.rb
index 3fbd272..ba05f9e 100644
--- a/apps/workbench/app/helpers/pipeline_instances_helper.rb
+++ b/apps/workbench/app/helpers/pipeline_instances_helper.rb
@@ -308,8 +308,8 @@ module PipelineInstancesHelper
 
   def render_unreadable_inputs_present
     if current_user and controller.class.name.eql?('PipelineInstancesController') and unreadable_inputs_present?
-      raw('<div class="unreadable-inputs-present">' +
-            '<p style="color:#ff6666">One or more inputs provided are not readable by you. ' +
+      raw('<div class="alert alert-danger unreadable-inputs-present">' +
+            '<p>One or more inputs provided are not readable by you. ' +
               'Please correct these before you can run the pipeline.</p></div>')
     end
   end
diff --git a/apps/workbench/test/integration/anonymous_access_test.rb b/apps/workbench/test/integration/anonymous_access_test.rb
index d1782b8..9f31ef9 100644
--- a/apps/workbench/test/integration/anonymous_access_test.rb
+++ b/apps/workbench/test/integration/anonymous_access_test.rb
@@ -247,6 +247,7 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
     ['new_pipeline_in_publicly_accessible_project_but_other_objects_elsewhere', false],
     ['new_pipeline_in_publicly_accessible_project_but_other_objects_elsewhere', false, 'spectator'],
     ['new_pipeline_in_publicly_accessible_project_but_other_objects_elsewhere', true, 'admin'],
+    ['new_pipeline_in_publicly_accessible_project_with_dataclass_file_and_other_objects_elsewhere', false, 'spectator'],
   ].each do |fixture, objects_readable, user=nil|
     test "access #{fixture} in public project with objects readable=#{objects_readable} with user #{user}" do
       object = api_fixture('pipeline_instances')[fixture]
diff --git a/services/api/test/fixtures/pipeline_instances.yml b/services/api/test/fixtures/pipeline_instances.yml
index 1f1b128..92d8707 100644
--- a/services/api/test/fixtures/pipeline_instances.yml
+++ b/services/api/test/fixtures/pipeline_instances.yml
@@ -338,6 +338,23 @@ new_pipeline_in_publicly_accessible_project_but_other_objects_elsewhere:
           dataclass: Collection
           value: zzzzz-4zz18-bv31uwvy3neko21
 
+new_pipeline_in_publicly_accessible_project_with_dataclass_file_and_other_objects_elsewhere:
+  uuid: zzzzz-d1hrv-newsharenotfile
+  owner_uuid: zzzzz-j7d0g-zhxawtyetzwc5f0
+  name: Pipeline in public project in New state with file type data class with objects elsewhere
+  pipeline_template_uuid: zzzzz-p5p6p-aox0k0ofxrystgw
+  state: New
+  created_at: 2014-09-15 12:00:00
+  components:
+    foo:
+      script: foo
+      script_version: master
+      script_parameters:
+        input:
+          required: true
+          dataclass: File
+          value: zzzzz-4zz18-bv31uwvy3neko21
+
 pipeline_in_running_state:
   name: running_with_job
   state: Ready

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list