Read about our upcoming Code of Conduct on this issue

group_url_constrainer.rb 291 Bytes
Newer Older
1
2
class GroupUrlConstrainer
  def matches?(request)
3
4
5
6
    id = request.params[:id]

    return false unless valid?(id)

7
    Group.find_by_full_path(id).present?
8
9
10
  end

  private
11

12
13
14
  def valid?(id)
    id.split('/').all? do |namespace|
      NamespaceValidator.valid?(namespace)
15
    end
16
17
  end
end