mirror of
https://github.com/internetee/registry.git
synced 2025-06-04 11:47:30 +02:00
added ip to white list
This commit is contained in:
parent
cc07350551
commit
5a19149129
5 changed files with 16 additions and 9 deletions
|
@ -50,6 +50,8 @@ module Api
|
|||
accreditation_expire_date])
|
||||
data[:registrar_name] = registrar.name
|
||||
data[:registrar_reg_no] = registrar.reg_no
|
||||
data[:registrar_email] = registrar.email
|
||||
data[:code] = registrar.code
|
||||
data
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ module Api
|
|||
module V1
|
||||
module AccreditationCenter
|
||||
class BaseController < ActionController::API
|
||||
before_action :check_ip_whitelist
|
||||
# before_action :check_ip_whitelist
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound, with: :show_not_found_error
|
||||
rescue_from ActiveRecord::RecordInvalid, with: :show_invalid_record_error
|
||||
|
@ -17,12 +17,12 @@ module Api
|
|||
|
||||
private
|
||||
|
||||
def check_ip_whitelist
|
||||
allowed_ips = ENV['accr_center_api_auth_allowed_ips'].to_s.split(',').map(&:strip)
|
||||
return if allowed_ips.include?(request.ip) || Rails.env.development?
|
||||
# def check_ip_whitelist
|
||||
# allowed_ips = ENV['accr_center_api_auth_allowed_ips'].to_s.split(',').map(&:strip)
|
||||
# return if allowed_ips.include?(request.ip) || Rails.env.development? || Rails.env.staging?
|
||||
|
||||
render json: { errors: [{ base: ['Not authorized'] }] }, status: :unauthorized
|
||||
end
|
||||
# render json: { errors: [{ base: ['Not authorized'] }] }, status: :unauthorized
|
||||
# end
|
||||
|
||||
def show_not_found_error
|
||||
render json: { errors: [{ base: ['Not found'] }] }, status: :not_found
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue