Sha256: e52b371bc26d0bb5ae22c2eb10543472956c6cb1d559f6c5cc75d024b712e636
Contents?: true
Size: 1.2 KB
Versions: 10
Compression:
Stored size: 1.2 KB
Contents
module OpenStax module Api module V1 class ApiController < ActionController::Base include ::Roar::Rails::ControllerAdditions include OpenStax::Api::Roar include OpenStax::Api::Apipie doorkeeper_for :all, :unless => :session_user? skip_before_filter :verify_authenticity_token, :unless => :session_user? respond_to :json # Keep old current_user method so we can use it alias_method :current_session_user, OpenStax::Api.configuration.current_user_method # Ensure we will never again confuse human users and api users undef_method OpenStax::Api.configuration.current_user_method # Always return an ApiUser def current_api_user @current_api_user ||= ApiUser.new(doorkeeper_token, lambda { current_session_user }) end def current_application current_api_user.application end def current_human_user current_api_user.human_user end protected def session_user? !!current_session_user && doorkeeper_token.blank? end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems