Commit 1b7ecf82 authored by Daniel Gerhardt's avatar Daniel Gerhardt

Forbid creation of groups with a path length < 5

This restriction does not apply to admins.
parent 03d16198
......@@ -21,6 +21,8 @@ class GroupsController < Groups::ApplicationController
before_action :user_actions, only: [:show]
before_filter :validate_name, only: :create
skip_cross_project_access_check :index, :new, :create, :edit, :update,
:destroy, :projects
# When loading show as an atom feed, we render events that could leak cross
......@@ -190,6 +192,14 @@ class GroupsController < Groups::ApplicationController
def validate_name
@group =
unless @group.path.empty? || @group.path.length > 4 || current_user.admin?[:alert] = 'Path must have at least a length of 5.'
render action: "new"
def build_canonical_path(group)
return group_path(group) if action_name == 'show' # root group path
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment