Sha256: 518b8a8371b54cc93815ea9297b4db6df89ced29c01de43784e08653283e52c2

Contents?: true

Size: 751 Bytes

Versions: 9

Compression:

Stored size: 751 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

    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

9 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-mongodb-4.1.0 lib/doorkeeper/orm/mongoid7/application.rb
doorkeeper-mongodb-4.1.0 lib/doorkeeper/orm/mongoid4/application.rb
doorkeeper-mongodb-4.1.0 lib/doorkeeper/orm/mongoid5/application.rb
doorkeeper-mongodb-4.0.1 lib/doorkeeper/orm/mongoid5/application.rb
doorkeeper-mongodb-4.0.1 lib/doorkeeper/orm/mongoid4/application.rb
doorkeeper-mongodb-4.0.1 lib/doorkeeper/orm/mongoid7/application.rb
doorkeeper-mongodb-4.0.0 lib/doorkeeper/orm/mongoid4/application.rb
doorkeeper-mongodb-4.0.0 lib/doorkeeper/orm/mongoid7/application.rb
doorkeeper-mongodb-4.0.0 lib/doorkeeper/orm/mongoid5/application.rb