5160: Workbench hides anonymous sharing when browsing disabled.
[arvados.git] / apps / workbench / app / controllers / jobs_controller.rb
index b1ef33a8e526f0c7d7de32f7cb6fef30f144702d..b90210f6a9b7be4c7bbea8a1193000ac9e8a7a56 100644 (file)
@@ -1,4 +1,9 @@
 class JobsController < ApplicationController
+  skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+    Rails.configuration.anonymous_user_token and
+    'show' == ctrl.action_name
+  }
+
   include JobsHelper
 
   def generate_provenance(jobs)
@@ -64,7 +69,8 @@ class JobsController < ApplicationController
                         ["object_uuid", "in", [@object.uuid]]])
                .limit(500)
                .results
-               .reverse
+               .to_a
+               .map{ |e| e.serializable_hash.merge({ 'prepend' => true }) }
     respond_to do |format|
       format.json { render json: @logs }
     end
@@ -79,6 +85,8 @@ class JobsController < ApplicationController
   end
 
   def show_pane_list
-    %w(Status Log Details Provenance Advanced)
+    panes = %w(Status Log Details Provenance Advanced)
+    panes.delete 'Log' if !current_user
+    panes
   end
 end