Sha256: d6794920a4acc8290ecd924da5e776901a1e7b4e31a0fe01dd5318155f5e66c9
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
module Doorkeeper class Application < ActiveRecord::Base if Doorkeeper.configuration.active_record_options[:establish_connection] establish_connection Doorkeeper.configuration.active_record_options[:establish_connection] end self.table_name = "#{self.table_name_prefix}oauth_applications#{self.table_name_suffix}".to_sym if ActiveRecord::VERSION::MAJOR >= 4 has_many :authorized_tokens, -> { where(revoked_at: nil) }, class_name: 'AccessToken' else has_many :authorized_tokens, class_name: 'AccessToken', conditions: { revoked_at: nil } end has_many :authorized_applications, through: :authorized_tokens, source: :application def self.column_names_with_table self.column_names.map { |c| "#{self.table_name}.#{c}" } end def self.authorized_for(resource_owner) joins(:authorized_applications). where(Doorkeeper::AccessToken.table_name => { resource_owner_id: resource_owner.id, revoked_at: nil }). group(column_names_with_table.join(',')) end end end
Version data entries
3 entries across 3 versions & 1 rubygems