summaryrefslogtreecommitdiff
path: root/lib/constraints/group_url_constrainer.rb
blob: 2af6e1a11c861c5f1a843f360ef0fddf96cdaa73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require_relative 'constrainer_helper'

class GroupUrlConstrainer
  include ConstrainerHelper

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

    if id =~ Gitlab::Regex.namespace_regex
      Group.find_by(path: id).present?
    else
      false
    end
  end
end