diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-03 03:10:23 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-03 03:10:23 +0300 |
commit | 3bbc597f60f05baae319cc541564bf41639fd14e (patch) | |
tree | 3454a662854d115ad6f5a5ffc1afb21bc4fde008 /app/models/personal_access_token.rb | |
parent | 36e64e679dfc3e5989445f06aa238962df6ca98d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/personal_access_token.rb')
-rw-r--r-- | app/models/personal_access_token.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/personal_access_token.rb b/app/models/personal_access_token.rb index 8fc93e6f954..ed996589489 100644 --- a/app/models/personal_access_token.rb +++ b/app/models/personal_access_token.rb @@ -24,6 +24,7 @@ class PersonalAccessToken < ApplicationRecord scope :expiring_and_not_notified, ->(date) { where(["revoked = false AND expire_notification_delivered = false AND expires_at >= CURRENT_DATE AND expires_at <= ?", date]) } scope :expired_today_and_not_notified, -> { where(["revoked = false AND expires_at = CURRENT_DATE AND after_expiry_notification_delivered = false"]) } scope :inactive, -> { where("revoked = true OR expires_at < CURRENT_DATE") } + scope :created_before, -> (date) { where("personal_access_tokens.created_at < :date", date: date) } scope :last_used_before, -> (date) { where("personal_access_tokens.created_at < :date AND (last_used_at < :date OR last_used_at IS NULL)", date: date) } scope :with_impersonation, -> { where(impersonation: true) } scope :without_impersonation, -> { where(impersonation: false) } |