mirror of
https://github.com/internetee/registry.git
synced 2025-05-21 11:49:40 +02:00
parent
787cca8e4c
commit
35afbf1f8c
15 changed files with 304 additions and 54 deletions
25
app/models/authorization/restricted_ip.rb
Normal file
25
app/models/authorization/restricted_ip.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
module Authorization
|
||||
class RestrictedIP
|
||||
def initialize(ip)
|
||||
@ip = ip
|
||||
end
|
||||
|
||||
def self.enabled?
|
||||
Setting.registrar_ip_whitelist_enabled
|
||||
end
|
||||
|
||||
def can_access_registrar_area?(registrar)
|
||||
return true unless self.class.enabled?
|
||||
registrar.white_ips.registrar_area.include_ip?(ip)
|
||||
end
|
||||
|
||||
def can_access_registrar_area_sign_in_page?
|
||||
return true unless self.class.enabled?
|
||||
WhiteIp.registrar_area.include_ip?(ip)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :ip
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue