diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /app/finders/ci/jobs_finder.rb | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'app/finders/ci/jobs_finder.rb')
-rw-r--r-- | app/finders/ci/jobs_finder.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/finders/ci/jobs_finder.rb b/app/finders/ci/jobs_finder.rb index 152eb271694..1627e41a02d 100644 --- a/app/finders/ci/jobs_finder.rb +++ b/app/finders/ci/jobs_finder.rb @@ -16,6 +16,7 @@ module Ci def execute builds = init_collection.order_id_desc + builds = filter_by_with_artifacts(builds) filter_by_scope(builds) rescue Gitlab::Access::AccessDeniedError type.none @@ -30,7 +31,7 @@ module Ci end def all_jobs - raise Gitlab::Access::AccessDeniedError unless current_user&.admin? + raise Gitlab::Access::AccessDeniedError unless current_user&.can_admin_all_resources? type.all end @@ -72,6 +73,14 @@ module Ci end end + def filter_by_with_artifacts(builds) + if params[:with_artifacts] + builds.with_erasable_artifacts + else + builds + end + end + def filter_by_statuses!(builds) unknown_statuses = params[:scope] - ::CommitStatus::AVAILABLE_STATUSES raise ArgumentError, 'Scope contains invalid value(s)' unless unknown_statuses.empty? |