summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2018-05-09 16:59:59 +0200
committerDylan Griffith <dyl.griffith@gmail.com>2018-05-16 10:52:28 +0200
commit18821b157dbf3a73637ab741e8154b5133ce0e72 (patch)
tree63cfb67cbeff4ea96e528543d9112371ba94fdb9
parent7320684c00ada153c0a9b102f8cf2db38367129a (diff)
downloadgitlab-ce-18821b157dbf3a73637ab741e8154b5133ce0e72.tar.gz
Improve efficiency of authorized_runner policy query
-rw-r--r--app/policies/ci/runner_policy.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/policies/ci/runner_policy.rb b/app/policies/ci/runner_policy.rb
index 2908989b154..82d8e86ae05 100644
--- a/app/policies/ci/runner_policy.rb
+++ b/app/policies/ci/runner_policy.rb
@@ -3,7 +3,7 @@ module Ci
with_options scope: :subject, score: 0
condition(:locked, scope: :subject) { @subject.locked? }
- condition(:authorized_runner) { @user.ci_authorized_runners.include?(@subject) }
+ condition(:authorized_runner) { @user.ci_authorized_runners.exists?(@subject.id) }
rule { anonymous }.prevent_all
rule { admin | authorized_runner }.enable :assign_runner