Sha256: 09aa336a81f9dc950acb1235219e59ace99452325a7b2ed6edf2c6a5f20bed9b

Contents?: true

Size: 427 Bytes

Versions: 2

Compression:

Stored size: 427 Bytes

Contents

class ApiController < ActionController::API
  <% if options[:doorkeeper_oauth] %>
  before_action :doorkeeper_authorize!, unless: :anonymous_action?
  
  def current_resource_owner
    User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token
  end
  alias_method :current_user, :current_resource_owner
  
  protected
  def anonymous_action?
    false
  end
  <% else %>
  def current_user
    nil
  end
  <% end %>
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mobile_workflow-0.3.1 lib/generators/mobile_workflow/install/templates/api_controller.rb.erb
mobile_workflow-0.2.0 lib/generators/mobile_workflow/install/templates/api_controller.rb.erb