summaryrefslogtreecommitdiff
path: root/app/policies/ci/build_policy.rb
blob: 7b1752df0e1a230f43ed10ce41a8360de16cb017 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Ci
  class BuildPolicy < CommitStatusPolicy
    def rules
      can! :read_build if @subject.project.public_builds?

      super

      # If we can't read build we should also not have that
      # ability when looking at this in context of commit_status
      %w[read create update admin].each do |rule|
        cannot! :"#{rule}_commit_status" unless can? :"#{rule}_build"
      end
    end
  end
end