2018-10-06 19:10:08 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-08 07:56:54 -05:00
|
|
|
module Constraints
|
|
|
|
class GroupUrlConstrainer
|
|
|
|
def matches?(request)
|
|
|
|
full_path = request.params[:group_id] || request.params[:id]
|
2016-11-14 09:55:31 -05:00
|
|
|
|
2018-03-08 07:56:54 -05:00
|
|
|
return false unless NamespacePathValidator.valid_path?(full_path)
|
2016-11-14 09:55:31 -05:00
|
|
|
|
2018-03-08 07:56:54 -05:00
|
|
|
Group.find_by_full_path(full_path, follow_redirects: request.get?).present?
|
|
|
|
end
|
2016-11-14 09:55:31 -05:00
|
|
|
end
|
2016-10-06 08:14:24 -04:00
|
|
|
end
|