diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
commit | ee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch) | |
tree | f8479f94a28f66654c6a4f6fb99bad6b4e86a40e /app/finders/personal_access_tokens_finder.rb | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'app/finders/personal_access_tokens_finder.rb')
-rw-r--r-- | app/finders/personal_access_tokens_finder.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/app/finders/personal_access_tokens_finder.rb b/app/finders/personal_access_tokens_finder.rb index 7d356c1014c..8403c531945 100644 --- a/app/finders/personal_access_tokens_finder.rb +++ b/app/finders/personal_access_tokens_finder.rb @@ -18,6 +18,12 @@ class PersonalAccessTokensFinder tokens = by_impersonation(tokens) tokens = by_state(tokens) tokens = by_owner_type(tokens) + tokens = by_revoked_state(tokens) + tokens = by_created_before(tokens) + tokens = by_created_after(tokens) + tokens = by_last_used_before(tokens) + tokens = by_last_used_after(tokens) + tokens = by_search(tokens) sort(tokens) end @@ -83,4 +89,40 @@ class PersonalAccessTokensFinder tokens end end + + def by_revoked_state(tokens) + return tokens unless params.has_key?(:revoked) + + params[:revoked] ? tokens.revoked : tokens.not_revoked + end + + def by_created_before(tokens) + return tokens unless params[:created_before] + + tokens.created_before(params[:created_before]) + end + + def by_created_after(tokens) + return tokens unless params[:created_after] + + tokens.created_after(params[:created_after]) + end + + def by_last_used_before(tokens) + return tokens unless params[:last_used_before] + + tokens.last_used_before(params[:last_used_before]) + end + + def by_last_used_after(tokens) + return tokens unless params[:last_used_after] + + tokens.last_used_after(params[:last_used_after]) + end + + def by_search(tokens) + return tokens unless params[:search] + + tokens.search(params[:search]) + end end |