Sha256: d09d609ed1f292168715eb09f1fe348d74ad1abbaad95b1f212d381e4908386e

Contents?: true

Size: 623 Bytes

Versions: 1

Compression:

Stored size: 623 Bytes

Contents

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

    self.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

1 entries across 1 versions & 1 rubygems

Version Path
couchkeeper-0.6.7 lib/doorkeeper/models/mongoid3/application.rb