Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2018-03-27 08:31:43 +0300
committerDylan Griffith <dyl.griffith@gmail.com>2018-04-09 03:46:42 +0300
commit0e78c2e9c925d180a443d132658691adf18f26a1 (patch)
tree1ffbd6c6c880dbd0e40bfd1e31f6125a0c3a3ec4 /app/models/user.rb
parent86ca1a77c58b508fc1b037c5fffbfb22fd992b42 (diff)
Allow group owner to enable runners from subgroups (#41981)
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 2b95be3f888..01ca1446376 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -955,6 +955,10 @@ class User < ActiveRecord::Base
Gitlab::GroupHierarchy.new(owned_and_master_groups).base_and_descendants
end
+ def manageable_group_projects
+ Project.where(namespace: manageable_groups)
+ end
+
def namespaces
namespace_ids = groups.pluck(:id)
namespace_ids.push(namespace.id)
@@ -1205,12 +1209,15 @@ class User < ActiveRecord::Base
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)
+ manageable_other_projects = projects.where(members: {
+ access_level: [Gitlab::Access::MASTER, Gitlab::Access::OWNER]
+ })
- Gitlab::SQL::Union.new([personal_projects.select(:id), groups.select(:id),
- other.select(:id)])
+ Gitlab::SQL::Union.new([
+ manageable_group_projects.select(:id),
+ personal_projects.select(:id),
+ manageable_other_projects.select(:id)
+ ])
end
# Added according to https://github.com/plataformatec/devise/blob/7df57d5081f9884849ca15e4fde179ef164a575f/README.md#activejob-integration