2659: load @prov_svg outside of the 'if current_user' block so that an anonymous...
[arvados.git] / apps / workbench / app / models / arvados_api_client.rb
index 5b2311dce98da44407a2f9dfc76436c2f1af1b29..904673fe286faff21e416d4d1892c098a842961e 100644 (file)
@@ -119,6 +119,12 @@ class ArvadosApiClient
     else
       query["_method"] = "GET"
     end
+
+    # Use anonymous token for GET requests when no api_token is available
+    if ((query["_method"] == "GET") or (query[:_method] == "GET")) && query["api_token"].empty?
+      query['api_token'] = Rails.configuration.anonymous_user_token
+    end
+
     if @@profiling_enabled
       query["_profile"] = "true"
     end
@@ -140,6 +146,7 @@ class ArvadosApiClient
     rescue Oj::ParseError
       resp = nil
     end
+
     if not resp.is_a? Hash
       raise InvalidApiResponseException.new(url, msg)
     elsif msg.status_code != 200