Sha256: 8db62a1d07973b2109552b2cfbff99e51fc148a4f95263390a47e5e3be1ece6b

Contents?: true

Size: 805 Bytes

Versions: 6

Compression:

Stored size: 805 Bytes

Contents

module Doorkeeper
  class Application
    include Mongoid::Document
    include Mongoid::Timestamps

    include DoorkeeperMongodb::Compatible

    include DoorkeeperMongodb::Shared::Scopes
    include DoorkeeperMongodb::Mixins::Mongoid::ApplicationMixin

    store_in collection: :oauth_applications

    field :name, type: String
    field :uid, type: String
    field :secret, type: String
    field :redirect_uri, type: String
    field :confidential, type: Boolean, default: true

    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

6 entries across 2 versions & 1 rubygems

Version Path
doorkeeper-mongodb-5.0.0 lib/doorkeeper/orm/mongoid4/application.rb
doorkeeper-mongodb-5.0.0 lib/doorkeeper/orm/mongoid5/application.rb
doorkeeper-mongodb-5.0.0 lib/doorkeeper/orm/mongoid7/application.rb
doorkeeper-mongodb-4.2.0 lib/doorkeeper/orm/mongoid4/application.rb
doorkeeper-mongodb-4.2.0 lib/doorkeeper/orm/mongoid5/application.rb
doorkeeper-mongodb-4.2.0 lib/doorkeeper/orm/mongoid7/application.rb