1 # == Schema Information
5 # id :integer not null, primary key
14 # index_acls_on_address (address) USING gist
15 # index_acls_on_domain (domain)
18 class Acl < ActiveRecord::Base
19 validates :k, :presence => true
21 def self.match(address, domain = nil)
23 Acl.where("address >>= ? OR domain = ?", address, domain)
25 Acl.where("address >>= ?", address)
29 def self.no_account_creation(address, domain = nil)
30 match(address, domain).where(:k => "no_account_creation").exists?
33 def self.no_note_comment(address, domain = nil)
34 match(address, domain).where(:k => "no_note_comment").exists?
37 def self.no_trace_download(address, domain = nil)
38 match(address, domain).where(:k => "no_trace_download").exists?