<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
require 'spam-lib.pl';

# acl_security_form(&amp;options)
# Output HTML for editing security options for the spam module
sub acl_security_form
{
# Allowed features
print "&lt;tr&gt; &lt;td valign=top&gt;&lt;b&gt;$text{'acl_avail'}&lt;/b&gt;&lt;/td&gt;\n";
print "&lt;td&gt;&lt;select name=avail rows=6 multiple&gt;\n";
local %avail = map { $_, 1 } split(/,/, $_[0]-&gt;{'avail'});
foreach $a ('white', 'score', 'report', 'user', 'header', 'priv', 'setup', 'procmail',
	    'amavisd', 'db', 'awl', 'manual') {
	printf "&lt;option value=%s %s&gt;%s&lt;/option&gt;\n",
		$a, $avail{$a} ? "selected" : "", $text{$a."_title"};
	}
print "&lt;/select&gt;&lt;/td&gt; &lt;/tr&gt;\n";

# Config file to edit
print "&lt;tr&gt; &lt;td&gt;&lt;b&gt;$text{'acl_file'}&lt;/b&gt;&lt;/td&gt;\n";
print "&lt;td&gt;",&amp;ui_opt_textbox("file", $_[0]-&gt;{'file'}, 40, $text{'acl_filedef'}),
      "&lt;/td&gt; &lt;/tr&gt;\n";

# Allowed auto-whitelist users
print "&lt;tr&gt; &lt;td&gt;&lt;b&gt;$text{'acl_awl'}&lt;/b&gt;&lt;/td&gt;\n";
print "&lt;td&gt;",&amp;ui_radio("awl_mode", $_[0]-&gt;{'awl_groups'} ? 2 :
				    $_[0]-&gt;{'awl_users'} ? 1 : 0,
	[ [ 0, $text{'acl_awl0'}."&lt;br&gt;\n" ],
	  [ 1, &amp;text('acl_awl1',
		&amp;ui_textbox("awl_users", $_[0]-&gt;{'awl_users'}, 40).
		&amp;user_chooser_button("awl_users", 1))."&lt;br&gt;\n" ],
	  [ 2, &amp;text('acl_awl2',
		&amp;ui_textbox("awl_groups", $_[0]-&gt;{'awl_groups'}, 40).
		&amp;group_chooser_button("awl_users", 1))."&lt;br&gt;\n" ],
	]),"&lt;/td&gt; &lt;/tr&gt;\n";
}

# acl_security_save(&amp;options)
# Parse the form for security options for the cron module
sub acl_security_save
{
$_[0]-&gt;{'avail'} = join(",", split(/\0/, $in{'avail'}));
$_[0]-&gt;{'file'} = $in{'file_def'} ? undef : $in{'file'};
delete($_[0]-&gt;{'awl_users'});
delete($_[0]-&gt;{'awl_groups'});
if ($in{'awl_mode'} == 1) {
	$_[0]-&gt;{'awl_users'} = $in{'awl_users'};
	}
elsif ($in{'awl_mode'} == 2) {
	$_[0]-&gt;{'awl_groups'} = $in{'awl_groups'};
	}
}

</pre></body></html>