Welcome to mirror list, hosted at ThFree Co, Russian Federation.

group_url_constrainer.rb « constraints « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5711d96a586775600c046ecb0e8fee1e5e315e84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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