Add expired/revoked scopes for doorkeeper models via extension modules (#29936)
This commit is contained in:
@@ -9,6 +9,10 @@ module AccessTokenExtension
|
||||
has_many :web_push_subscriptions, class_name: 'Web::PushSubscription', inverse_of: :access_token
|
||||
|
||||
after_commit :push_to_streaming_api
|
||||
|
||||
scope :expired, -> { where.not(expires_in: nil).where('created_at + MAKE_INTERVAL(secs => expires_in) < NOW()') }
|
||||
scope :not_revoked, -> { where(revoked_at: nil) }
|
||||
scope :revoked, -> { where.not(revoked_at: nil).where(revoked_at: ...Time.now.utc) }
|
||||
end
|
||||
|
||||
def revoke(clock = Time)
|
||||
|
||||
Reference in New Issue
Block a user