mirror of
https://github.com/internetee/registry.git
synced 2025-07-06 03:03:21 +02:00
Check API whitelist IP-s when loggin into registrar with pw #2713
This commit is contained in:
parent
8bffdbf783
commit
d26dd3da98
5 changed files with 38 additions and 17 deletions
|
@ -15,12 +15,10 @@ class WhiteIp < ActiveRecord::Base
|
|||
|
||||
API = 'api'
|
||||
REGISTRAR = 'registrar'
|
||||
GLOBAL = 'global'
|
||||
INTERFACES = [GLOBAL, API, REGISTRAR]
|
||||
INTERFACES = [API, REGISTRAR]
|
||||
|
||||
scope :api, -> { where(interface: API) }
|
||||
scope :registrar, -> { where(interface: REGISTRAR) }
|
||||
scope :global, -> { where(interface: GLOBAL) }
|
||||
|
||||
class << self
|
||||
def registrar_ip_white?(ip)
|
||||
|
@ -28,9 +26,7 @@ class WhiteIp < ActiveRecord::Base
|
|||
|
||||
at = WhiteIp.arel_table
|
||||
WhiteIp.where(
|
||||
at[:interface].eq(REGISTRAR).or(
|
||||
at[:interface].eq(GLOBAL)
|
||||
).and(
|
||||
at[:interface].eq(REGISTRAR).and(
|
||||
at[:ipv4].eq(ip)
|
||||
)
|
||||
).any?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue