2016-11-07 08:16:04 -05:00
|
|
|
require_relative 'constrainer_helper'
|
2016-10-06 08:14:24 -04:00
|
|
|
|
2016-11-07 08:16:04 -05:00
|
|
|
class UserUrlConstrainer
|
|
|
|
include ConstrainerHelper
|
|
|
|
|
|
|
|
def matches?(request)
|
|
|
|
id = extract_resource_path(request.path)
|
|
|
|
|
|
|
|
if id =~ Gitlab::Regex.namespace_regex
|
2016-11-08 07:32:42 -05:00
|
|
|
User.find_by('lower(username) = ?', id.downcase).present?
|
2016-11-07 08:16:04 -05:00
|
|
|
else
|
|
|
|
false
|
|
|
|
end
|
2016-10-06 08:14:24 -04:00
|
|
|
end
|
|
|
|
end
|