1 class Acl < ActiveRecord::Base
2 validates :k, :presence => true
4 def self.match(address, domain = nil)
6 Acl.where("address >>= ? OR domain = ?", address, domain)
8 Acl.where("address >>= ?", address)
12 def self.no_account_creation(address, domain = nil)
13 match(address, domain).where(:k => "no_account_creation").exists?
16 def self.no_note_comment(address, domain = nil)
17 match(address, domain).where(:k => "no_note_comment").exists?
20 def self.no_trace_download(address, domain = nil)
21 match(address, domain).where(:k => "no_trace_download").exists?