2016-11-07 08:16:04 -05:00
|
|
|
class GroupUrlConstrainer
|
|
|
|
def matches?(request)
|
2016-11-14 09:55:31 -05:00
|
|
|
id = request.params[:id]
|
|
|
|
|
|
|
|
return false unless valid?(id)
|
|
|
|
|
2016-10-31 07:00:53 -04:00
|
|
|
Group.find_by_full_path(id).present?
|
2016-11-14 09:55:31 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
2016-11-07 08:16:04 -05:00
|
|
|
|
2016-11-14 09:55:31 -05:00
|
|
|
def valid?(id)
|
|
|
|
id.split('/').all? do |namespace|
|
|
|
|
NamespaceValidator.valid?(namespace)
|
2016-11-07 08:16:04 -05:00
|
|
|
end
|
2016-10-06 08:14:24 -04:00
|
|
|
end
|
|
|
|
end
|