Sha256: 4bb986614d490c9338f92ec4a1279be3ab9443130278baee73f26493c358a54b

Contents?: true

Size: 647 Bytes

Versions: 14

Compression:

Stored size: 647 Bytes

Contents

module Doorkeeper
  class Application
    include Mongoid::Document
    include Mongoid::Timestamps
    include Models::Mongoid3::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

14 entries across 14 versions & 3 rubygems

Version Path
doorkeeper-mongodb-3.0.0 lib/doorkeeper/orm/mongoid3/application.rb
dd-doorkeeper-mongodb-3.0.0 lib/doorkeeper/orm/mongoid3/application.rb
doorkeeper-2.2.2 lib/doorkeeper/orm/mongoid3/application.rb
doorkeeper-2.2.1 lib/doorkeeper/orm/mongoid3/application.rb
doorkeeper-2.2.0 lib/doorkeeper/orm/mongoid3/application.rb
doorkeeper-2.1.4 lib/doorkeeper/orm/mongoid3/application.rb
doorkeeper-2.1.3 lib/doorkeeper/orm/mongoid3/application.rb
doorkeeper-2.1.2 lib/doorkeeper/orm/mongoid3/application.rb
doorkeeper-2.1.1 lib/doorkeeper/orm/mongoid3/application.rb
doorkeeper-2.1.0 lib/doorkeeper/orm/mongoid3/application.rb
doorkeeper-2.0.1 lib/doorkeeper/orm/mongoid3/application.rb
doorkeeper-2.0.0 lib/doorkeeper/orm/mongoid3/application.rb
doorkeeper-2.0.0.rc3 lib/doorkeeper/orm/mongoid3/application.rb
doorkeeper-2.0.0.rc2 lib/doorkeeper/orm/mongoid3/application.rb