summaryrefslogtreecommitdiff
path: root/app/policies
diff options
context:
space:
mode:
authorFabio Papa <fabtheman@gmail.com>2019-06-27 15:53:46 -0700
committerFabio Papa <fabtheman@gmail.com>2019-07-19 11:55:46 -0700
commitc96b503bfa05e9f1db727d5f03b0bc562bc69c11 (patch)
tree1ce80636dfb83867da3b20404243691ef7567e13 /app/policies
parent130261c5e984ae022543e08cb7ba4a82b1594612 (diff)
downloadgitlab-ce-c96b503bfa05e9f1db727d5f03b0bc562bc69c11.tar.gz
Add policy to allow maintainers to create subgroups when enabled
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/group_policy.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/policies/group_policy.rb b/app/policies/group_policy.rb
index 9219283992f..0add8bfad31 100644
--- a/app/policies/group_policy.rb
+++ b/app/policies/group_policy.rb
@@ -38,6 +38,10 @@ class GroupPolicy < BasePolicy
@subject.project_creation_level == ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS
end
+ condition(:maintainer_can_create_group) do
+ @subject.subgroup_creation_level == ::Gitlab::Access::MAINTAINER_SUBGROUP_ACCESS
+ end
+
rule { public_group }.policy do
enable :read_group
enable :read_list
@@ -105,6 +109,7 @@ class GroupPolicy < BasePolicy
end
rule { owner & nested_groups_supported }.enable :create_subgroup
+ rule { maintainer & maintainer_can_create_group & nested_groups_supported }.enable :create_subgroup
rule { public_group | logged_in_viewable }.enable :view_globally