GitLab steht aufgrund wichtiger Wartungsarbeiten am Montag, den 8. März, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

Commit 238208b2 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 f6ba2d0b
......@@ -18,6 +18,8 @@ class GroupsController < Groups::ApplicationController
before_action :user_actions, only: [:show, :subgroups]
before_filter :validate_name, only: :create
layout :determine_layout
def index
......@@ -176,6 +178,14 @@ def user_actions
end
end
def validate_name
@group = Group.new(group_params)
unless @group.path.empty? || @group.path.length > 4 || current_user.admin?
flash.now[:alert] = 'Path must have at least a length of 5.'
render action: "new"
end
end
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