Sha256: b5c79208a851bd4398475d7ff6dd6484eae6b3f8d87a2a4b2294e1b6b46575c9

Contents?: true

Size: 647 Bytes

Versions: 2

Compression:

Stored size: 647 Bytes

Contents

module Doorkeeper
  class Application
    include Mongoid::Document
    include Mongoid::Timestamps
    include Models::Mongoid5::Scopes

    include ApplicationMixin

    self.store_in collection: :oauth_applications

    field :name, type: String
    field :uid, type: String
    field :secret, type: String
    field :redirect_uri, type: String

    index({ uid: 1 }, { unique: true })

    has_many :authorized_tokens, class_name: 'Doorkeeper::AccessToken'

    def self.authorized_for(resource_owner)
      ids = AccessToken.where(resource_owner_id: resource_owner.id, revoked_at: nil).map(&:application_id)
      find(ids)
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
doorkeeper-mongodb-3.0.0 lib/doorkeeper/orm/mongoid5/application.rb
dd-doorkeeper-mongodb-3.0.0 lib/doorkeeper/orm/mongoid5/application.rb