Add expired/revoked scopes for doorkeeper models via extension modules (#29936)
This commit is contained in:
parent
1622f7aeb9
commit
665f6f09a0
5 changed files with 20 additions and 5 deletions
10
app/lib/access_grant_extension.rb
Normal file
10
app/lib/access_grant_extension.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module AccessGrantExtension
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
scope :expired, -> { where.not(expires_in: nil).where('created_at + MAKE_INTERVAL(secs => expires_in) < NOW()') }
|
||||
scope :revoked, -> { where.not(revoked_at: nil).where(revoked_at: ...Time.now.utc) }
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue