diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-04-09 13:21:01 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-04-09 13:21:01 +0300 |
commit | f22df3e9c1c590874cea8d50ab10f28467baaf18 (patch) | |
tree | 3c1342b3339099dd71c4ef3323ff52d15c784f7f /app/models | |
parent | 52440755dfe483b3c047856c91cece12fef114f0 (diff) | |
parent | f45b8888fc1a2694b8e2da64512137ab54a09a66 (diff) |
Merge branch '41981-allow-group-owner-to-enable-runners-from-subgroups' into 'master'
Resolve "Group owner cannot enable/disable specific-runners which was registered in a project under a subgroup"
Closes #41981
See merge request gitlab-org/gitlab-ce!18009
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user.rb | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 2b95be3f888..42bb27d4753 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -993,7 +993,7 @@ class User < ActiveRecord::Base def ci_authorized_runners @ci_authorized_runners ||= begin runner_ids = Ci::RunnerProject - .where("ci_runner_projects.project_id IN (#{ci_projects_union.to_sql})") # rubocop:disable GitlabSecurity/SqlInjection + .where(project: authorized_projects(Gitlab::Access::MASTER)) .select(:runner_id) Ci::Runner.specific.where(id: runner_ids) end @@ -1204,15 +1204,6 @@ class User < ActiveRecord::Base ], remove_duplicates: false) end - def ci_projects_union - scope = { access_level: [Gitlab::Access::MASTER, Gitlab::Access::OWNER] } - groups = groups_projects.where(members: scope) - other = projects.where(members: scope) - - Gitlab::SQL::Union.new([personal_projects.select(:id), groups.select(:id), - other.select(:id)]) - end - # Added according to https://github.com/plataformatec/devise/blob/7df57d5081f9884849ca15e4fde179ef164a575f/README.md#activejob-integration def send_devise_notification(notification, *args) return true unless can?(:receive_notifications) |