Sha256: 0325dc9c56284a894fc2042ac95ca66231d089d68c84005564a6fad7981504d5

Contents?: true

Size: 654 Bytes

Versions: 11

Compression:

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

11 entries across 11 versions & 1 rubygems

Version Path
doorkeeper-2.2.0 lib/doorkeeper/orm/mongo_mapper/application.rb
doorkeeper-2.1.4 lib/doorkeeper/orm/mongo_mapper/application.rb
doorkeeper-2.1.3 lib/doorkeeper/orm/mongo_mapper/application.rb
doorkeeper-2.1.2 lib/doorkeeper/orm/mongo_mapper/application.rb
doorkeeper-2.1.1 lib/doorkeeper/orm/mongo_mapper/application.rb
doorkeeper-2.1.0 lib/doorkeeper/orm/mongo_mapper/application.rb
doorkeeper-2.0.1 lib/doorkeeper/orm/mongo_mapper/application.rb
doorkeeper-2.0.0 lib/doorkeeper/orm/mongo_mapper/application.rb
doorkeeper-2.0.0.rc3 lib/doorkeeper/orm/mongo_mapper/application.rb
doorkeeper-2.0.0.rc2 lib/doorkeeper/orm/mongo_mapper/application.rb
doorkeeper-2.0.0.alpha1 lib/doorkeeper/orm/mongo_mapper/application.rb