6683fdcfb0
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
17 lines
287 B
Ruby
17 lines
287 B
Ruby
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
|