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/controllers/groups_controller.rb | |
parent | 4a2a6d521a260981482ee8e4931ebf06cb4f5b6a (diff) |
Improves subgroup creation permissions
Diffstat (limited to 'app/controllers/groups_controller.rb')
-rw-r--r-- | app/controllers/groups_controller.rb | 7 |
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 |