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

12 lines
314 B
Ruby
Raw Normal View History

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