Commit 1cfa5ed0 authored by Dylan Griffith's avatar Dylan Griffith

Refactor out duplication in runner_policy.rb

parent 983bc6b1
...@@ -6,10 +6,14 @@ module Ci ...@@ -6,10 +6,14 @@ module Ci
condition(:owned_runner) { @user.ci_owned_runners.exists?(@subject.id) } condition(:owned_runner) { @user.ci_owned_runners.exists?(@subject.id) }
rule { anonymous }.prevent_all rule { anonymous }.prevent_all
rule { admin | owned_runner }.enable :assign_runner
rule { admin | owned_runner }.enable :read_runner rule { admin | owned_runner }.policy do
rule { admin | owned_runner }.enable :update_runner enable :assign_runner
rule { admin | owned_runner }.enable :delete_runner enable :read_runner
enable :update_runner
enable :delete_runner
end
rule { ~admin & locked }.prevent :assign_runner rule { ~admin & locked }.prevent :assign_runner
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment