Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/ci/downloadable_artifact_entity.rb')
-rw-r--r--app/serializers/ci/downloadable_artifact_entity.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/serializers/ci/downloadable_artifact_entity.rb b/app/serializers/ci/downloadable_artifact_entity.rb
new file mode 100644
index 00000000000..1f3885f0715
--- /dev/null
+++ b/app/serializers/ci/downloadable_artifact_entity.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Ci
+ class DownloadableArtifactEntity < Grape::Entity
+ include RequestAwareEntity
+
+ expose :artifacts do |pipeline, options|
+ artifacts = pipeline.downloadable_artifacts
+
+ if Feature.enabled?(:non_public_artifacts)
+ artifacts = artifacts.select { |artifact| can?(request.current_user, :read_job_artifacts, artifact.job) }
+ end
+
+ BuildArtifactEntity.represent(artifacts, options.merge(project: pipeline.project))
+ end
+ end
+end