mirror of
https://github.com/internetee/registry.git
synced 2025-07-26 04:28:27 +02:00
Add feature to disable IP whitelist #2707
This commit is contained in:
parent
5a0fd06e20
commit
ffebff72dd
6 changed files with 32 additions and 2 deletions
|
@ -1,6 +1,5 @@
|
|||
class RegistrarController < ApplicationController
|
||||
before_action :authenticate_user!, :check_ip
|
||||
# before_action :check_ip
|
||||
layout 'registrar/application'
|
||||
|
||||
include Registrar::ApplicationHelper
|
||||
|
|
|
@ -75,7 +75,7 @@ class Registrar < ActiveRecord::Base
|
|||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
def issue_prepayment_invoice(amount, description = nil)
|
||||
def issue_prepayment_invoice(amount, description = nil)
|
||||
# Currently only EIS can issue invoices
|
||||
eis = self.class.eis
|
||||
|
||||
|
@ -157,10 +157,12 @@ class Registrar < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def api_ip_white?(ip)
|
||||
return true unless Setting.api_ip_whitelist_enabled
|
||||
white_ips.api.pluck(:ipv4, :ipv6).flatten.include?(ip) || global_ip_white?(ip)
|
||||
end
|
||||
|
||||
def registrar_ip_white?(ip)
|
||||
return true unless Setting.registrar_ip_whitelist_enabled
|
||||
white_ips.registrar.pluck(:ipv4, :ipv6).flatten.include?(ip) || global_ip_white?(ip)
|
||||
end
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ class WhiteIp < ActiveRecord::Base
|
|||
|
||||
class << self
|
||||
def registrar_ip_white?(ip)
|
||||
return true unless Setting.registrar_ip_whitelist_enabled
|
||||
|
||||
at = WhiteIp.arel_table
|
||||
WhiteIp.where(
|
||||
at[:interface].eq(REGISTRAR).or(
|
||||
|
|
|
@ -67,6 +67,8 @@
|
|||
= render 'setting_row', var: :transfer_wait_time
|
||||
= render 'setting_row', var: :ds_algorithm
|
||||
= render 'setting_row', var: :client_side_status_editing_enabled
|
||||
= render 'setting_row', var: :api_ip_whitelist_enabled
|
||||
= render 'setting_row', var: :registrar_ip_whitelist_enabled
|
||||
.row
|
||||
.col-md-12.text-right
|
||||
%button.btn.btn-primary=t(:save)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue