Whitelist/blacklist buttons from AWL
authorJamie Cameron <jcameron@webmin.com>
Thu, 4 Sep 2008 19:55:44 +0000 (19:55 +0000)
committerJamie Cameron <jcameron@webmin.com>
Thu, 4 Sep 2008 19:55:44 +0000 (19:55 +0000)
spam/CHANGELOG
spam/delete_awl.cgi
spam/edit_awl.cgi
spam/lang/en

index bca53c6..4baeac3 100644 (file)
@@ -13,3 +13,5 @@ Added the SQL and LDAP Databases page for configuring SpamAssassin to use a MySQ
 Added global configuration settings to use MySQL, PostgreSQL or LDAP backends for storing preferences.
 ---- Changes since 1.410 ----
 Auto-whitelists can now be viewed, deleted from and cleared for all users on the system. An access control option allows this to be limited to just certain users or group members.
+---- Changes since 1.430 ----
+Added buttons to the auto-whitelist page for permanently allowing or denying selected addresses.
index ac5b814..57d25db 100644 (file)
@@ -6,16 +6,35 @@ require './spam-lib.pl';
 &can_use_check("awl");
 &ReadParse();
 &can_edit_awl($in{'user'}) || &error($text{'dawl_ecannot'});
+$conf = &get_config();
 
 # Check stuff
 &open_auto_whitelist_dbm($in{'user'}) || &error($text{'dawl_eopen'});
 @d = split(/\0/, $in{'d'});
 @d || &error($text{'dawl_enone'});
 
-# Delete from hash
-foreach $d (@d) {
-       delete($awl{$d});
-       delete($awl{$d."|totscore"});
+if ($in{'white'}) {
+       # Add to whitelist
+       @d = map { s/\|.*$//; $_ } @d;
+       @from = map { @{$_->{'words'}} } &find("whitelist_from", $conf);
+       @from = &unique(@from, @d);
+       &save_directives($conf, "whitelist_from", \@from, 1);
+       &flush_file_lines();
+       }
+elsif ($in{'black'}) {
+       # Add to blacklist
+       @d = map { s/\|.*$//; $_ } @d;
+       @from = map { @{$_->{'words'}} } &find("blacklist_from", $conf);
+       @from = &unique(@from, @d);
+       &save_directives($conf, "blacklist_from", \@from, 1);
+       &flush_file_lines();
+       }
+else {
+       # Delete from AWL hash
+       foreach $d (@d) {
+               delete($awl{$d});
+               delete($awl{$d."|totscore"});
+               }
        }
 
 &close_auto_whitelist_dbm();
index 0aa718f..6abb6f9 100644 (file)
@@ -78,7 +78,7 @@ else {
        print &ui_columns_start([ "",
                                  $text{'awl_email'},
                                  $text{'awl_ip'},
-                                 $text{'awl_score'} ], \@tds);
+                                 $text{'awl_score'} ], undef, 0, \@tds);
        foreach $k (@keys) {
                ($email, $ip, $rest) = split(/\|/, $k);
                if ($ip eq "ip=none") {
@@ -95,7 +95,9 @@ else {
                }
        print &ui_columns_end();
        print &ui_links_row(\@links);
-       print &ui_form_end([ [ undef, $text{'awl_delete'} ] ]);
+       print &ui_form_end([ [ undef, $text{'awl_delete'} ],
+                            [ 'white', $text{'awl_white'} ],
+                            [ 'black', $text{'awl_black'} ] ]);
        }
 &close_auto_whitelist_dbm();
 
index ec7e599..f10ce3f 100644 (file)
@@ -353,6 +353,8 @@ awl_score=Score to apply
 awl_none=None
 awl_unknown=Unknown
 awl_delete=Remove Selected Entries
+awl_white=Permanently Allow
+awl_black=Permanently Deny
 awl_cannot=Usermin could not open your auto-whitelist file <tt>$1</tt>, perhaps because it is in an un-supported format.
 awl_empty=Your auto-whitelist file <tt>$1</tt> does not contain any entries. It will be populated by SpamAsssassin as mail is processed by the system.
 awl_user=Show auto-whitelist for user: