diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/serializers/ci | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/serializers/ci')
-rw-r--r-- | app/serializers/ci/downloadable_artifact_entity.rb | 17 | ||||
-rw-r--r-- | app/serializers/ci/downloadable_artifact_serializer.rb | 7 | ||||
-rw-r--r-- | app/serializers/ci/pipeline_entity.rb | 2 |
3 files changed, 25 insertions, 1 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 diff --git a/app/serializers/ci/downloadable_artifact_serializer.rb b/app/serializers/ci/downloadable_artifact_serializer.rb new file mode 100644 index 00000000000..fc4c9fa558e --- /dev/null +++ b/app/serializers/ci/downloadable_artifact_serializer.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module Ci + class DownloadableArtifactSerializer < BaseSerializer + entity DownloadableArtifactEntity + end +end diff --git a/app/serializers/ci/pipeline_entity.rb b/app/serializers/ci/pipeline_entity.rb index 743643a978f..fa0e904fbde 100644 --- a/app/serializers/ci/pipeline_entity.rb +++ b/app/serializers/ci/pipeline_entity.rb @@ -121,4 +121,4 @@ class Ci::PipelineEntity < Grape::Entity end end -Ci::PipelineEntity.prepend_if_ee('EE::Ci::PipelineEntity') +Ci::PipelineEntity.prepend_mod_with('Ci::PipelineEntity') |