X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1ec89c1c31669eb89bd1997cfa9d3c50f0204dbe..1c6d77f980ea3d560fec8c4f0dafe3fe0d2b23fc:/apps/workbench/app/controllers/application_controller.rb diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index 3ca0fc73c0..523ef7f781 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -255,7 +255,7 @@ class ApplicationController < ActionController::Base f.html { if params['tab_pane'] render_pane(if params['tab_pane'].is_a? Hash then params['tab_pane']["name"] else params['tab_pane'] end) - elsif request.method.in? ['GET', 'HEAD'] + elsif request.request_method.in? ['GET', 'HEAD'] render else redirect_to (params[:return_to] || @@ -267,6 +267,17 @@ class ApplicationController < ActionController::Base end end + def redirect_to uri, *args + if request.xhr? + if not uri.is_a? String + uri = polymorphic_url(uri) + end + render json: {href: uri} + else + super + end + end + def choose params[:limit] ||= 40 respond_to do |f| @@ -390,7 +401,7 @@ class ApplicationController < ActionController::Base @user_is_manager = false @share_links = [] - if @object.uuid != current_user.uuid + if @object.uuid != current_user.andand.uuid begin @share_links = Link.permissions_for(@object) @user_is_manager = true @@ -435,6 +446,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 +509,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 @@ -646,6 +658,7 @@ class ApplicationController < ActionController::Base end def check_user_profile + return true if !current_user if request.method.downcase != 'get' || params[:partial] || params[:tab_pane] || params[:action_method] || params[:action] == 'setup_popup'