summaryrefslogtreecommitdiff
path: root/app/controllers/groups_controller.rb
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2017-08-09 11:58:00 +0100
committerTiago Botelho <tiagonbotelho@hotmail.com>2017-08-21 15:40:22 +0100
commit5bc9dedf401a10388b9505ccbc11d4802ff76a43 (patch)
tree418d9ccd51c40a612ce81b336363ad4efcdbed67 /app/controllers/groups_controller.rb
parent4a2a6d521a260981482ee8e4931ebf06cb4f5b6a (diff)
downloadgitlab-ce-5bc9dedf401a10388b9505ccbc11d4802ff76a43.tar.gz
Improves subgroup creation permissions35845-improve-subgroup-creation-permissions
Diffstat (limited to 'app/controllers/groups_controller.rb')
-rw-r--r--app/controllers/groups_controller.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index f76b3f69e9e..994e736d66e 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -26,6 +26,13 @@ class GroupsController < Groups::ApplicationController
def new
@group = Group.new
+
+ if params[:parent_id].present?
+ parent = Group.find_by(id: params[:parent_id])
+ if can?(current_user, :create_subgroup, parent)
+ @group.parent = parent
+ end
+ end
end
def create