group_url_constrainer.rb 285 Bytes
Newer Older
1
require_relative 'constrainer_helper'
2

3 4 5 6 7 8 9
class GroupUrlConstrainer
  include ConstrainerHelper

  def matches?(request)
    id = extract_resource_path(request.path)

    if id =~ Gitlab::Regex.namespace_regex
10
      Group.find_by(path: id).present?
11 12 13
    else
      false
    end
14 15
  end
end