#192: Checks ip address in api defender

This commit is contained in:
Vokhmin Alexey V 2013-07-04 14:51:36 +04:00
parent 8c3c524460
commit e735c6e5f5
1 changed files with 3 additions and 1 deletions

View File

@ -51,7 +51,9 @@ class ApiDefender < Rack::Throttle::Hourly
# only API calls should be throttled
def need_defense?(request)
request.env['PATH_INFO'] =~ /^\/api\/v1\// && !system_user?(request)
APP_CONFIG['allowed_addresses'].exclude?(request.ip) &&
request.env['PATH_INFO'] =~ /^\/api\/v1\// &&
!system_user?(request)
end
def authorized?(request)