1 # == Schema Information
5 # id :bigint(8) not null, primary key
15 # index_acls_on_address (address) USING gist
16 # index_acls_on_domain (domain)
17 # index_acls_on_mx (mx)
20 class Acl < ActiveRecord::Base
21 validates :k, :presence => true
23 def self.match(address, options = {})
24 acls = Acl.where("address >>= ?", address)
26 acls = acls.or(Acl.where(:domain => options[:domain])) if options[:domain]
27 acls = acls.or(Acl.where(:mx => options[:mx])) if options[:mx]
32 def self.no_account_creation(address, options = {})
33 match(address, options).where(:k => "no_account_creation").exists?
36 def self.no_note_comment(address, domain = nil)
37 match(address, :domain => domain).where(:k => "no_note_comment").exists?
40 def self.no_trace_download(address, domain = nil)
41 match(address, :domain => domain).where(:k => "no_trace_download").exists?