diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2017-08-09 13:58:00 +0300 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2017-08-21 17:40:22 +0300 |
commit | 5bc9dedf401a10388b9505ccbc11d4802ff76a43 (patch) | |
tree | 418d9ccd51c40a612ce81b336363ad4efcdbed67 /app/policies/group_policy.rb | |
parent | 4a2a6d521a260981482ee8e4931ebf06cb4f5b6a (diff) |
Improves subgroup creation permissions
Diffstat (limited to 'app/policies/group_policy.rb')
-rw-r--r-- | app/policies/group_policy.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/policies/group_policy.rb b/app/policies/group_policy.rb index 6defab75fce..8ada661e571 100644 --- a/app/policies/group_policy.rb +++ b/app/policies/group_policy.rb @@ -13,6 +13,8 @@ class GroupPolicy < BasePolicy condition(:master) { access_level >= GroupMember::MASTER } condition(:reporter) { access_level >= GroupMember::REPORTER } + condition(:nested_groups_supported, scope: :global) { Group.supports_nested_groups? } + condition(:has_projects) do GroupProjectsFinder.new(group: @subject, current_user: @user).execute.any? end @@ -42,7 +44,7 @@ class GroupPolicy < BasePolicy enable :change_visibility_level end - rule { owner & can_create_group }.enable :create_subgroup + rule { owner & can_create_group & nested_groups_supported }.enable :create_subgroup rule { public_group | logged_in_viewable }.enable :view_globally |