Sha256: 2e776886bf1137f3e731054a728d6722e9bf21b2aa40f819e08060e4a8d3ec38

Contents?: true

Size: 806 Bytes

Versions: 4

Compression:

Stored size: 806 Bytes

Contents

require 'doorkeeper-mongodb/compatible'

module Doorkeeper
  class AccessGrant
    include DoorkeeperMongodb::Compatible

    include MongoMapper::Document

    include DoorkeeperMongodb::Mixins::MongoMapper::AccessGrantMixin

    safe
    timestamps!

    set_collection_name 'oauth_access_grants'

    key :resource_owner_id, ObjectId
    key :application_id,    ObjectId
    key :token,             String
    key :scopes,            String
    key :expires_in,        Integer
    key :redirect_uri,      String
    key :revoked_at,        DateTime

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

    def save!(options = {})
      if options.key?(:validate)
        super(options.merge(safe: options.delete(:validate)))
      else
        super
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
doorkeeper-mongodb-4.2.0 lib/doorkeeper/orm/mongo_mapper/access_grant.rb
doorkeeper-mongodb-4.1.0 lib/doorkeeper/orm/mongo_mapper/access_grant.rb
doorkeeper-mongodb-4.0.1 lib/doorkeeper/orm/mongo_mapper/access_grant.rb
doorkeeper-mongodb-4.0.0 lib/doorkeeper/orm/mongo_mapper/access_grant.rb