From: Matt Amos Date: Tue, 4 Aug 2009 12:59:02 +0000 (+0000) Subject: Use method rather than direct access to member for the current token. X-Git-Tag: live~7765^2~8 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/d75bc6ef690c3c42daedc78342167306eccf38af Use method rather than direct access to member for the current token. --- diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 110682947..d9bc9e4f1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -31,8 +31,8 @@ class ApplicationController < ActionController::Base def require_capability(cap) # when the current token is nil, it means the user logged in with a different # method, otherwise an OAuth token was used, which has to be checked. - unless @current_token.nil? - unless @current_token.read_attribute(cap) + unless current_token.nil? + unless current_token.read_attribute(cap) render :text => "OAuth token doesn't have that capability.", :status => :forbidden return false end @@ -66,7 +66,7 @@ class ApplicationController < ActionController::Base def setup_user_auth # try and setup using OAuth if oauthenticate - @user = @current_token.user + @user = current_token.user else username, passwd = get_auth_data # parse from headers # authenticate per-scheme