app/controllers/openstax/api/v1/api_controller.rb in openstax_api-1.0.3 vs app/controllers/openstax/api/v1/api_controller.rb in openstax_api-1.0.4

- old
+ new

@@ -18,19 +18,19 @@ if respond_to? :fine_print_skip_signatures skip_protect_beta if respond_to? :skip_protect_beta skip_before_filter :authenticate_user! - doorkeeper_for :all, :unless => :application_user_without_token? + doorkeeper_for :all, :unless => :user_without_token? skip_before_filter :verify_authenticity_token, - :unless => :application_user_without_token? + :unless => :user_without_token? respond_to :json rescue_from Exception, :with => :rescue_from_exception # Keep old current_user method so we can use it - alias_method :current_application_user, + alias_method :current_human_user, OpenStax::Api.configuration.current_user_method # TODO: doorkeeper users (or rather users who have doorkeeper # applications) need to agree to API terms of use (need to have agreed # to it at one time, can't require them to agree when terms change since @@ -41,17 +41,17 @@ # agreement, etc) # Always return an ApiUser def current_user @current_api_user ||= ApiUser.new(doorkeeper_token, - lambda { current_application_user }) + lambda { current_human_user }) end protected - def application_user_without_token? - current_application_user && doorkeeper_token.blank? + def user_without_token? + current_human_user && doorkeeper_token.blank? end def rescue_from_exception(exception) # See https://github.com/rack/rack/blob/master/lib/rack/utils.rb#L453 for error names/symbols error = :internal_server_error @@ -79,11 +79,9 @@ Rails.logger.error("An exception occurred: #{exception.message}\n\n#{exception.backtrace.join("\n")}") \ end head error end - - end end end \ No newline at end of file