Welcome to mirror list, hosted at ThFree Co, Russian Federation.

runner_policy.rb « ci « policies « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7dff8470e23b31cd0684f343bf9aa0aabd810cb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module Ci
  class RunnerPolicy < BasePolicy
    with_options scope: :subject, score: 0
    condition(:shared) { @subject.is_shared? }

    with_options scope: :subject, score: 0
    condition(:locked, scope: :subject) { @subject.locked? }

    condition(:authorized_runner) { @user.ci_authorized_runners.include?(@subject) }

    rule { anonymous }.prevent_all
    rule { admin | authorized_runner }.enable :assign_runner
    rule { ~admin & shared }.prevent :assign_runner
    rule { ~admin & locked }.prevent :assign_runner
  end
end