Sha256: 7cecf95e5f230f85d341e54c8bd3ec95ae9dab44e6208b267b1731100a342b58

Contents?: true

Size: 658 Bytes

Versions: 9

Compression:

Stored size: 658 Bytes

Contents

module Doorkeeper
  class AccessToken < ActiveRecord::Base
    self.table_name = :oauth_access_tokens

    def self.delete_all_for(application_id, resource_owner)
      where(:application_id => application_id,
            :resource_owner_id => resource_owner.id).delete_all
    end
    private_class_method :delete_all_for

    def self.last_authorized_token_for(application, resource_owner_id)
      where(:application_id => application.id,
            :resource_owner_id => resource_owner_id,
            :revoked_at => nil).
      order('created_at desc').
      limit(1).
      first
    end
    private_class_method :last_authorized_token_for
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
doorkeeper-0.6.7 lib/doorkeeper/models/active_record/access_token.rb
doorkeeper-0.6.6 lib/doorkeeper/models/active_record/access_token.rb
doorkeeper-0.6.5 lib/doorkeeper/models/active_record/access_token.rb
doorkeeper-0.6.4 lib/doorkeeper/models/active_record/access_token.rb
doorkeeper-0.6.3 lib/doorkeeper/models/active_record/access_token.rb
doorkeeper-0.6.2 lib/doorkeeper/models/active_record/access_token.rb
doorkeeper-0.6.1 lib/doorkeeper/models/active_record/access_token.rb
doorkeeper-0.6.0 lib/doorkeeper/models/active_record/access_token.rb
doorkeeper-0.6.0.rc1 lib/doorkeeper/models/active_record/access_token.rb