Sha256: 031aefc05ca3324a1b196228b7b09c5dadc3149299f53b2bdefca442690ef38c

Contents?: true

Size: 557 Bytes

Versions: 6

Compression:

Stored size: 557 Bytes

Contents

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

    self.store_in :oauth_applications

    field :name, type: String
    field :uid, type: String
    field :secret, type: String
    field :redirect_uri, type: String

    index :uid, 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 6 versions & 1 rubygems

Version Path
doorkeeper-1.4.2 lib/doorkeeper/models/mongoid2/application.rb
doorkeeper-1.4.1 lib/doorkeeper/models/mongoid2/application.rb
doorkeeper-1.4.0 lib/doorkeeper/models/mongoid2/application.rb
doorkeeper-1.3.1 lib/doorkeeper/models/mongoid2/application.rb
doorkeeper-1.3.0 lib/doorkeeper/models/mongoid2/application.rb
doorkeeper-1.2.0 lib/doorkeeper/models/mongoid2/application.rb