mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 21:16:12 +02:00
Add rate limiting to all repp actions
This commit is contained in:
parent
fb60466194
commit
2a58bf3849
48 changed files with 757 additions and 16 deletions
|
@ -27,6 +27,10 @@ module Repp
|
|||
@response = { code: 2201, message: 'Authorization error' }
|
||||
logger.error e.to_s
|
||||
render(json: @response, status: :unauthorized)
|
||||
rescue Shunter::ThrottleError => e
|
||||
@response = { code: 2502, message: Shunter.default_error_message }
|
||||
logger.error e.to_s
|
||||
render(json: @response, status: :bad_request)
|
||||
ensure
|
||||
create_repp_log
|
||||
end
|
||||
|
@ -167,6 +171,11 @@ module Repp
|
|||
data[:abilities] = Ability.new(current_user).permissions
|
||||
data
|
||||
end
|
||||
|
||||
def throttled_user
|
||||
authorize!(:throttled_user, @domain) unless current_user
|
||||
current_user
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue