]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow to create settings for authenticated users
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 2 Aug 2016 13:49:03 +0000 (14:49 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 2 Aug 2016 13:49:03 +0000 (14:49 +0100)
Use `authenticated = true;` for this feature

src/plugins/lua/settings.lua

index cb7e4743f6d2b286fb4fb690c05d3d29885d8739..18059a9a6157d43247810078d78e475767bf1a39 100644 (file)
@@ -139,9 +139,16 @@ local function check_settings(task)
     return false
   end
 
-  local function check_specific_setting(name, rule, ip, client_ip, from, rcpt, user)
+  local function check_specific_setting(name, rule, ip, client_ip, from, rcpt,
+      user, auth_user)
     local res = false
 
+    if rule['authenticated'] then
+      if auth_user then
+        res = true
+      end
+    end
+
     if rule['ip'] then
       if not ip then
         return nil
@@ -262,7 +269,7 @@ local function check_settings(task)
   for pri = max_pri,1,-1 do
     if settings[pri] then
       for name, r in pairs(settings[pri]) do
-        local rule = check_specific_setting(name, r, ip, client_ip, from, rcpt, user)
+        local rule = check_specific_setting(name, r, ip, client_ip, from, rcpt, user, uname)
         if rule then
           rspamd_logger.infox(task, "<%1> apply settings according to rule %2",
             task:get_message_id(), name)