X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/41000078b9e0131d75ce610f148655fb7b32da73..fff5a755d367dba9d1f845ca64653c7893915e5a:/app/controllers/application_controller.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a809139ce..0988fcdf8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -5,6 +5,9 @@ class ApplicationController < ActionController::Base before_action :fetch_body + attr_accessor :current_user + helper_method :current_user + def authorize_web if session[:user] self.current_user = User.where(:id => session[:user]).where("status IN ('active', 'confirmed', 'suspended')").first @@ -47,7 +50,7 @@ class ApplicationController < ActionController::Base end def require_oauth - @oauth = @user.access_token(OAUTH_KEY) if current_user && defined? OAUTH_KEY + @oauth = current_user.access_token(OAUTH_KEY) if current_user && defined? OAUTH_KEY end ## @@ -343,7 +346,7 @@ class ApplicationController < ActionController::Base # or raises a suitable error. +method+ should be a symbol, e.g: :put or :get. def assert_method(method) ok = request.send((method.to_s.downcase + "?").to_sym) - raise OSM::APIBadMethodError.new(method) unless ok + raise OSM::APIBadMethodError, method unless ok end ## @@ -466,16 +469,6 @@ class ApplicationController < ActionController::Base [user, pass] end - # used to get the current logged in user - def current_user - @user - end - - # used to set the current logged in user - def current_user=(user) - @user = user - end - # override to stop oauth plugin sending errors def invalid_oauth_response; end end