Sha256: aeca36e844b3ff1a86be5767058eca0919d2a450c2a10abd607e4ed42ba81028

Contents?: true

Size: 612 Bytes

Versions: 3

Compression:

Stored size: 612 Bytes

Contents

class Oauth2::UsersController < Oauth2Controller
  before_filter :ensure_token!
  before_filter :find_user

  def show
    attributes = @user.try!(:oauth_attributes) || @user.attributes.only(*%w[name email uuid])
    render :json => attributes
  end

  protected

  def find_user
    @user = User.where(:uuid => @access_token.user_id).first or render(:nothing => true, :status => :bad_request)
  end

  def ensure_token!
    unless token = params[:access_token] || params[:oauth_token]
      raise Vidibus::Oauth2Server::MissingTokenError
    end
    @access_token = Oauth2Token.find!(:token => token)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vidibus-oauth2_server-0.0.6 app/controllers/oauth2/users_controller.rb
vidibus-oauth2_server-0.0.5 app/controllers/oauth2/users_controller.rb
vidibus-oauth2_server-0.0.4 app/controllers/oauth2/users_controller.rb