[ARVADOS] updated: e1104f98771283a7659eadf881f006e3a3acb4d5
git at public.curoverse.com
git at public.curoverse.com
Tue Feb 3 11:18:42 EST 2015
Summary of changes:
.../app/controllers/application_controller.rb | 3 ++-
apps/workbench/app/models/arvados_api_client.rb | 14 +++++++-------
apps/workbench/app/views/application/404.html.erb | 22 ++++++++++++++--------
.../app/controllers/arvados/v1/links_controller.rb | 2 +-
services/api/app/models/arvados_model.rb | 1 +
5 files changed, 25 insertions(+), 17 deletions(-)
via e1104f98771283a7659eadf881f006e3a3acb4d5 (commit)
via 17c5cc48844053d6aec318fa3fc8fe95b2cf1b4c (commit)
via 42fc0557db4117d736b7511a0f785bdfa1d5111e (commit)
from 7edde4785f7cc325a8c2b109d6fcda176af2650c (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 e1104f98771283a7659eadf881f006e3a3acb4d5
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Feb 3 11:18:56 2015 -0500
2659: Fix up 404 page.
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 02ae656..b52591b 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -435,6 +435,7 @@ class ApplicationController < ActionController::Base
protected
+ helper_method :strip_token_from_path
def strip_token_from_path(path)
path.sub(/([\?&;])api_token=[^&;]*[&;]?/, '\1')
end
@@ -497,7 +498,7 @@ class ApplicationController < ActionController::Base
else
@object = model_class.find(params[:uuid])
end
- rescue ArvadosApiClient::NotFoundException, RuntimeError => error
+ rescue ArvadosApiClient::NotFoundException, ArvadosApiClient::NotLoggedInException, RuntimeError => error
if error.is_a?(RuntimeError) and (error.message !~ /^argument to find\(/)
raise
end
diff --git a/apps/workbench/app/views/application/404.html.erb b/apps/workbench/app/views/application/404.html.erb
index 4c8fa76..aa1ffda 100644
--- a/apps/workbench/app/views/application/404.html.erb
+++ b/apps/workbench/app/views/application/404.html.erb
@@ -13,18 +13,24 @@
<h2>Not Found</h2>
+<p>The <%= req_item %> was not found.</p>
+
<% if !current_user %>
-<p>You are not logged into Arvados. Please retry after log in.</p><br/>
-<% end %>
-<p>The <%= req_item %> was not found.
+ <p>
+ (I notice you are not logged in. If you're looking for a private
+ page, you'll need to <%=link_to 'log in', arvados_api_client.arvados_login_url(return_to: strip_token_from_path(request.url))%> first.)
+ </p>
-<% if class_name %>
-Perhaps you'd like to
-<%= link_to("browse all #{class_name_h.pluralize}", action: :index, controller: class_name.tableize) %>?
-<% end %>
+<% elsif class_name %>
-</p>
+ <p>
+ Perhaps you'd like to <%= link_to("browse all
+ #{class_name_h.pluralize}", action: :index, controller:
+ class_name.tableize) %>?
+ </p>
+
+<% end %>
<% error_message = "The #{req_item_plain_text} was not found." %>
<%= render :partial => "report_error", :locals => {error_message: error_message, error_type: '404'} %>
commit 17c5cc48844053d6aec318fa3fc8fe95b2cf1b4c
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Feb 3 10:40:13 2015 -0500
2659: Fix crashes when current_user is nil.
diff --git a/services/api/app/controllers/arvados/v1/links_controller.rb b/services/api/app/controllers/arvados/v1/links_controller.rb
index 798217d..acc7100 100644
--- a/services/api/app/controllers/arvados/v1/links_controller.rb
+++ b/services/api/app/controllers/arvados/v1/links_controller.rb
@@ -20,7 +20,7 @@ class Arvados::V1::LinksController < ApplicationController
end
def get_permissions
- if current_user.can?(manage: @object)
+ if current_user.andand.can?(manage: @object)
# find all links and return them
@objects = Link.where(link_class: "permission",
head_uuid: params[:uuid])
diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index 308da7f..9442a6f 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -107,6 +107,7 @@ class ArvadosModel < ActiveRecord::Base
# If current user cannot write this object, just return
# [self.owner_uuid].
def writable_by
+ return [owner_uuid] if not current_user
unless (owner_uuid == current_user.uuid or
current_user.is_admin or
(current_user.groups_i_can(:manage) & [uuid, owner_uuid]).any?)
commit 42fc0557db4117d736b7511a0f785bdfa1d5111e
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Feb 3 10:29:42 2015 -0500
2659: Send anonymous token as a reader token with all requests.
diff --git a/apps/workbench/app/models/arvados_api_client.rb b/apps/workbench/app/models/arvados_api_client.rb
index 904673f..992f8fd 100644
--- a/apps/workbench/app/models/arvados_api_client.rb
+++ b/apps/workbench/app/models/arvados_api_client.rb
@@ -101,8 +101,13 @@ class ArvadosApiClient
url.sub! '/arvados/v1/../../', '/'
query = {
- 'api_token' => tokens[:arvados_api_token] || Thread.current[:arvados_api_token] || '',
- 'reader_tokens' => (tokens[:reader_tokens] || Thread.current[:reader_tokens] || []).to_json,
+ 'api_token' => (tokens[:arvados_api_token] ||
+ Thread.current[:arvados_api_token] ||
+ ''),
+ 'reader_tokens' => ((tokens[:reader_tokens] ||
+ Thread.current[:reader_tokens] ||
+ []) +
+ [Rails.configuration.anonymous_user_token]).to_json,
}
if !data.nil?
data.each do |k,v|
@@ -120,11 +125,6 @@ class ArvadosApiClient
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
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list