class PassiveDNS::TLPSecurityControl

Constants

LEVELS

Public Class Methods

new(tlp) click to toggle source
# File lib/passivedns/client.rb, line 31
def initialize(tlp)
  if tlp =~ /(white|green|yellow|red)/i
    @tlp = tlp.downcase
    @tlp_level = LEVELS.index(@tlp)
  else
    raise "Unknown TLP setting, #{tlp}"
  end
end

Public Instance Methods

allow(user_level) click to toggle source
# File lib/passivedns/client.rb, line 40
def allow(user_level)
  user_level = LEVELS.index(user_level.downcase)
  if user_level == nil
    raise "Invalid user level, #{user_level}"
  end
  return(user_level >= @tlp_level)
end
to_s() click to toggle source
# File lib/passivedns/client.rb, line 48
def to_s()
  @tlp
end