summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2018-05-10 14:42:55 +0200
committerDylan Griffith <dyl.griffith@gmail.com>2018-05-16 10:52:28 +0200
commitc3f9d80a6e0950361e056ded4107015d3923f56d (patch)
tree91155d2ef99e8fd9feca798b1a6dd1d3f5519d9d /app
parent18821b157dbf3a73637ab741e8154b5133ce0e72 (diff)
downloadgitlab-ce-c3f9d80a6e0950361e056ded4107015d3923f56d.tar.gz
Rename User#ci_authorized_runners -> ci_owned_runners
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/settings/ci_cd_controller.rb2
-rw-r--r--app/models/user.rb4
-rw-r--r--app/policies/ci/runner_policy.rb12
3 files changed, 9 insertions, 9 deletions
diff --git a/app/controllers/projects/settings/ci_cd_controller.rb b/app/controllers/projects/settings/ci_cd_controller.rb
index 177c8a54099..1d850baf012 100644
--- a/app/controllers/projects/settings/ci_cd_controller.rb
+++ b/app/controllers/projects/settings/ci_cd_controller.rb
@@ -69,7 +69,7 @@ module Projects
@project_runners = @project.runners.ordered
@assignable_runners = current_user
- .ci_authorized_runners
+ .ci_owned_runners
.assignable_for(project)
.ordered
.page(params[:page]).per(20)
diff --git a/app/models/user.rb b/app/models/user.rb
index 2afe9ea77f9..226a4489261 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -999,8 +999,8 @@ class User < ActiveRecord::Base
!solo_owned_groups.present?
end
- def ci_authorized_runners
- @ci_authorized_runners ||= begin
+ def ci_owned_runners
+ @ci_owned_runners ||= begin
project_runner_ids = Ci::RunnerProject
.where(project: authorized_projects(Gitlab::Access::MASTER))
.select(:runner_id)
diff --git a/app/policies/ci/runner_policy.rb b/app/policies/ci/runner_policy.rb
index 82d8e86ae05..61912696e88 100644
--- a/app/policies/ci/runner_policy.rb
+++ b/app/policies/ci/runner_policy.rb
@@ -3,14 +3,14 @@ module Ci
with_options scope: :subject, score: 0
condition(:locked, scope: :subject) { @subject.locked? }
- condition(:authorized_runner) { @user.ci_authorized_runners.exists?(@subject.id) }
+ condition(:owned_runner) { @user.ci_owned_runners.exists?(@subject.id) }
rule { anonymous }.prevent_all
- rule { admin | authorized_runner }.enable :assign_runner
- rule { admin | authorized_runner }.enable :read_runner
- rule { admin | authorized_runner }.enable :update_runner
- rule { admin | authorized_runner }.enable :delete_runner
- rule { admin | authorized_runner }.enable :list_runner_jobs
+ rule { admin | owned_runner }.enable :assign_runner
+ rule { admin | owned_runner }.enable :read_runner
+ rule { admin | owned_runner }.enable :update_runner
+ rule { admin | owned_runner }.enable :delete_runner
+ rule { admin | owned_runner }.enable :list_runner_jobs
rule { ~admin & locked }.prevent :assign_runner
end
end