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:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-12-29 20:18:05 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-12-29 20:18:05 +0300
commit283e868ef523185b0ee314b9e2164599780d888b (patch)
tree2ce1512216edc13b2072e0af190df9142690cf80 /app/services/groups
parent10de4e3bb612a529480c93da53849d95e98a8633 (diff)
Refactor nested group related code
* Simplify code around group parent access check * Rename 'Nested groups' to 'Subgroups' tab at group#show page Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/services/groups')
-rw-r--r--app/services/groups/create_service.rb14
1 files changed, 4 insertions, 10 deletions
diff --git a/app/services/groups/create_service.rb b/app/services/groups/create_service.rb
index 9a630aee626..febeb661fb5 100644
--- a/app/services/groups/create_service.rb
+++ b/app/services/groups/create_service.rb
@@ -12,17 +12,11 @@ module Groups
return @group
end
- parent_id = params[:parent_id]
+ if @group.parent && !can?(current_user, :admin_group, @group.parent)
+ @group.parent = nil
+ @group.errors.add(:parent_id, 'manage access required to create subgroup')
- if parent_id
- parent = Group.find(parent_id)
-
- unless can?(current_user, :admin_group, parent)
- @group.parent_id = nil
- @group.errors.add(:parent_id, 'manage access required to create subgroup')
-
- return @group
- end
+ return @group
end
@group.name ||= @group.path.dup