Sha256: acec1dfc93422253ac3d20b62524b2f55f8a4bc837f4d760e4b34ae8795fcd69
Contents?: true
Size: 764 Bytes
Versions: 5
Compression:
Stored size: 764 Bytes
Contents
class Api::V1::BaseController < ApplicationController include ModelHash attr_accessor :current_user, :current_user_token, :installation_identifier protected def set_user @user = params[:user_id].present? ? User.where(id: params[:user_id]).first : nil end def requires_authentication_token authenticate_or_request_with_http_token do |token, options| self.installation_identifier = options[:installation_identifier] self.current_user_token = UserToken.where(token: token, installation_identifier: installation_identifier).first self.current_user = sign_in(:user, current_user_token.user) if current_user_token.try(:user).present? current_user.present? ? (current_user_token.try(:touch); true) : false end end end
Version data entries
5 entries across 5 versions & 1 rubygems