Sha256: 73ad1f36f9ba26030c44fab95fd9df567ba4a368a0017835a6a422673faa949e

Contents?: true

Size: 673 Bytes

Versions: 1

Compression:

Stored size: 673 Bytes

Contents

require_relative 'models/application_mixin'

module Doorkeeper
  class Application < Sequel::Model
    set_dataset :oauth_applications

    include Doorkeeper::Orm::Sequel::ApplicationMixin

    one_to_many :authorized_tokens, class: 'Doorkeeper::AccessToken', conditions: { revoked_at: nil }
    many_to_many :authorized_applications, join_table: :oauth_access_tokens,
                                           class: self, left_key: :id, right_key: :application_id

    def self.authorized_for(resource_owner)
      resource_access_tokens = AccessToken.active_for(resource_owner)
      where(id: resource_access_tokens.select_map(:application_id)).all
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
doorkeeper-sequel-1.2.1 lib/doorkeeper/orm/sequel/application.rb