]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/acl.rb
Remove unused user_blocks translations
[rails.git] / app / models / acl.rb
index 90dd7f3cf48d19f30f9b6a5da185b4af0744eed6..a65c3a35ad68977fe1a1da5f6296c280006145a0 100644 (file)
@@ -23,7 +23,15 @@ class Acl < ApplicationRecord
   def self.match(address, options = {})
     acls = Acl.where("address >>= ?", address)
 
-    acls = acls.or(Acl.where(:domain => options[:domain])) if options[:domain]
+    if options[:domain]
+      labels = options[:domain].split(".")
+
+      until labels.empty?
+        acls = acls.or(Acl.where(:domain => labels.join(".")))
+        labels.shift
+      end
+    end
+
     acls = acls.or(Acl.where(:mx => options[:mx])) if options[:mx]
 
     acls