Sha256: 737b368f3b39221f699eaada1331b258e983a210a4abab24102c07381ee9a1d8

Contents?: true

Size: 684 Bytes

Versions: 4

Compression:

Stored size: 684 Bytes

Contents

module Doorkeeper
  class Application
    include MongoMapper::Document

    include ApplicationMixin

    safe
    timestamps!

    set_collection_name 'oauth_applications'

    many :authorized_tokens, class_name: 'Doorkeeper::AccessToken'

    key :name,         String
    key :uid,          String
    key :secret,       String
    key :redirect_uri, String
    key :scopes,       String

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

    def self.create_indexes
      ensure_index :uid, unique: true
    end
  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
doorkeeper-mongodb-3.0.0 lib/doorkeeper/orm/mongo_mapper/application.rb
dd-doorkeeper-mongodb-3.0.0 lib/doorkeeper/orm/mongo_mapper/application.rb
doorkeeper-2.2.2 lib/doorkeeper/orm/mongo_mapper/application.rb
doorkeeper-2.2.1 lib/doorkeeper/orm/mongo_mapper/application.rb