2021-06-08 01:23:25 +05:30
|
|
|
# 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)
|
2023-03-17 16:20:25 +05:30
|
|
|
artifacts = artifacts.select { |artifact| can?(request.current_user, :read_job_artifacts, artifact) }
|
2021-06-08 01:23:25 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
BuildArtifactEntity.represent(artifacts, options.merge(project: pipeline.project))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|