debian-mirror-gitlab/lib/constraints/group_url_constrainer.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
345 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2018-05-09 12:01:36 +05:30
module Constraints
class GroupUrlConstrainer
def matches?(request)
full_path = request.params[:group_id] || request.params[:id]
2016-11-03 12:29:30 +05:30
2018-05-09 12:01:36 +05:30
return false unless NamespacePathValidator.valid_path?(full_path)
2017-08-17 22:00:37 +05:30
2018-05-09 12:01:36 +05:30
Group.find_by_full_path(full_path, follow_redirects: request.get?).present?
end
2016-11-03 12:29:30 +05:30
end
end