gitlab-org--gitlab-foss/lib/constraints/group_url_constrainer.rb

18 lines
291 B
Ruby
Raw Normal View History

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