debian-mirror-gitlab/app/policies/ci/job_artifact_policy.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
578 B
Ruby
Raw Normal View History

2022-10-11 01:57:18 +05:30
# frozen_string_literal: true
module Ci
class JobArtifactPolicy < BasePolicy
delegate { @subject.job.project }
2023-03-17 16:20:25 +05:30
condition(:public_access, scope: :subject) do
@subject.public_access?
end
condition(:can_read_project_build, scope: :subject) do
can?(:read_build, @subject.job.project)
end
condition(:has_access_to_project) do
can?(:developer_access, @subject.job.project)
end
rule { can_read_project_build }.enable :read_job_artifacts
rule { ~public_access & ~has_access_to_project }.prevent :read_job_artifacts
2022-10-11 01:57:18 +05:30
end
end