app/models/access_grant.rb in doorkeeper-0.1.0 vs app/models/access_grant.rb in doorkeeper-0.1.1
- old
+ new
@@ -1,9 +1,9 @@
class AccessGrant < ActiveRecord::Base
include Doorkeeper::OAuth::RandomString
- self.table_name = "oauth_access_grants"
+ set_table_name :oauth_access_grants
belongs_to :application
validates :resource_owner_id, :application_id, :token, :expires_in, :redirect_uri, :presence => true
@@ -12,10 +12,18 @@
def expired?
expires_in.present? && Time.now > expired_time
end
def accessible?
- !expired?
+ !expired? && !revoked?
+ end
+
+ def revoke
+ update_attribute :revoked_at, DateTime.now
+ end
+
+ def revoked?
+ revoked_at.present?
end
private
def expired_time