diff options
author | Clement Ho <ClemMakesApps@gmail.com> | 2018-05-17 16:58:36 +0300 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2018-05-17 16:58:36 +0300 |
commit | fd5fdb2c1aba95b8dc851e80cb7216551052122d (patch) | |
tree | 745d4a60a5f029644767cee9e8284b514fcb5a5a /app/policies/ci | |
parent | 42189e9185e59758deb93ea4ea625e2dc6f99524 (diff) | |
parent | ec7163ae1db54f4adce7942673abc8a4a073fbd6 (diff) |
Merge branch 'master' into bootstrap4
Diffstat (limited to 'app/policies/ci')
-rw-r--r-- | app/policies/ci/runner_policy.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/app/policies/ci/runner_policy.rb b/app/policies/ci/runner_policy.rb index 7dff8470e23..895abe87d86 100644 --- a/app/policies/ci/runner_policy.rb +++ b/app/policies/ci/runner_policy.rb @@ -1,16 +1,19 @@ 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) } + condition(:owned_runner) { @user.ci_owned_runners.exists?(@subject.id) } rule { anonymous }.prevent_all - rule { admin | authorized_runner }.enable :assign_runner - rule { ~admin & shared }.prevent :assign_runner + + rule { admin | owned_runner }.policy do + enable :assign_runner + enable :read_runner + enable :update_runner + enable :delete_runner + end + rule { ~admin & locked }.prevent :assign_runner end end |