Sha256: a9f7d215e765b47f90bbdda2b419ce226d17f5e001fce2d1965c50c6b4859e72

Contents?: true

Size: 725 Bytes

Versions: 3

Compression:

Stored size: 725 Bytes

Contents

module Doorkeeper
  class AccessGrant < ActiveRecord::Base
    include Doorkeeper::OAuth::Helpers
    include Doorkeeper::Models::Expirable
    include Doorkeeper::Models::Revocable
    include Doorkeeper::Models::Scopes

    self.table_name = :oauth_access_grants

    belongs_to :application

    attr_accessible :resource_owner_id, :application_id, :expires_in, :redirect_uri, :scopes

    validates :resource_owner_id, :application_id, :token, :expires_in, :redirect_uri, :presence => true

    before_validation :generate_token, :on => :create

    def accessible?
      !expired? && !revoked?
    end

    private

    def generate_token
      self.token = UniqueToken.generate_for :token, self.class
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-0.4.2 app/models/doorkeeper/access_grant.rb
doorkeeper-0.4.1 app/models/doorkeeper/access_grant.rb
doorkeeper-0.4.0 app/models/doorkeeper/access_grant.rb