Sha256: 81a7c09d0dfc6130bb14fb8c1a2951f0169a0b1baae5383a4a1f2261be95b132
Contents?: true
Size: 972 Bytes
Versions: 8
Compression:
Stored size: 972 Bytes
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 = :oauth_applications 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(oauth_access_tokens: { resource_owner_id: resource_owner.id, revoked_at: nil }) .group(column_names_with_table.join(',')) end end end
Version data entries
8 entries across 8 versions & 1 rubygems