diff options
Diffstat (limited to 'app/serializers/ci/downloadable_artifact_entity.rb')
-rw-r--r-- | app/serializers/ci/downloadable_artifact_entity.rb | 17 |
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 |