gitlab-org--gitlab-foss/lib/constraints/group_url_constrainer.rb
Dmitriy Zaporozhets 6683fdcfb0
Add nested groups support to the routing
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-11-23 14:08:36 +02:00

17 lines
287 B
Ruby

class GroupUrlConstrainer
def matches?(request)
id = request.params[:id]
return false unless valid?(id)
Group.find_by(path: id).present?
end
private
def valid?(id)
id.split('/').all? do |namespace|
NamespaceValidator.valid?(namespace)
end
end
end