do 'acl-lib.pl';
# acl_security_form(&options)
# Output HTML for editing security options for the acl module
sub acl_security_form
{
local $o = $_[0];
print "
$text{'acl_users'} \n";
print "\n";
printf " %s\n",
$o->{'users'} eq '*' ? 'checked' : '', $text{'acl_uall'};
printf " %s \n",
$o->{'users'} eq '~' ? 'checked' : '', $text{'acl_uthis'};
printf " %s \n",
$o->{'users'} eq '*' || $o->{'users'} eq '~' ? '' : 'checked',
$text{'acl_usel'};
print "\n";
map { $ucan{$_}++ } split(/\s+/, $o->{'users'});
foreach $u (&list_users()) {
printf "%s\n",
$ucan{$u->{'name'}} ? 'selected' : '',
$u->{'name'};
}
foreach $g (&list_groups()) {
printf " %s\n",
$ucan{'_'.$g->{'name'}} ? 'selected' : '',
'_'.$g->{'name'}, &text('acl_gr', $g->{'name'});
}
print " \n";
print "$text{'acl_mods'} ",
"\n";
printf " %s \n",
$o->{'mode'} == 0 ? 'checked' : '', $text{'acl_all'};
printf " %s \n",
$o->{'mode'} == 1 ? 'checked' : '', $text{'acl_own'};
printf " %s \n",
$o->{'mode'} == 2 ? 'checked' : '', $text{'acl_sel'};
print " \n";
map { $mcan{$_}++ } split(/\s+/, $o->{'mods'});
foreach $m (&list_module_infos()) {
printf "%s\n",
$m->{'dir'}, $mcan{$m->{'dir'}} ? 'selected' :'',
$m->{'desc'};
}
print " \n";
print " $text{'acl_create'} \n";
printf " $text{'yes'}\n",
$o->{'create'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'create'} ? '' : 'checked';
print "$text{'acl_delete'} \n";
printf " $text{'yes'}\n",
$o->{'delete'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'delete'} ? '' : 'checked';
print " $text{'acl_rename'} \n";
printf " $text{'yes'}\n",
$o->{'rename'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'rename'} ? '' : 'checked';
print "$text{'acl_acl'} \n";
printf " $text{'yes'}\n",
$o->{'acl'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'acl'} ? '' : 'checked';
print " $text{'acl_cert'} \n";
printf " $text{'yes'}\n",
$o->{'cert'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'cert'} ? '' : 'checked';
print "$text{'acl_others'} \n";
printf " $text{'yes'}\n",
$o->{'others'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'others'} ? '' : 'checked';
print " $text{'acl_chcert'} \n";
printf " $text{'yes'}\n",
$o->{'chcert'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'chcert'} ? '' : 'checked';
print "$text{'acl_lang'} \n";
printf " $text{'yes'}\n",
$o->{'lang'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'lang'} ? '' : 'checked';
print " $text{'acl_cats'} \n";
printf " $text{'yes'}\n",
$o->{'cats'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'cats'} ? '' : 'checked';
print "$text{'acl_theme'} \n";
printf " $text{'yes'}\n",
$o->{'theme'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'theme'} ? '' : 'checked';
print " $text{'acl_ips'} \n";
printf " $text{'yes'}\n",
$o->{'ips'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'ips'} ? '' : 'checked';
print " $text{'acl_perms'} \n";
printf " $text{'acl_perms_1'}\n",
$o->{'perms'} ? 'checked' : '';
printf " $text{'acl_perms_0'} \n",
$o->{'perms'} ? '' : 'checked';
print " \n";
print " $text{'acl_sync'} \n";
printf " $text{'yes'}\n",
$o->{'sync'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'sync'} ? '' : 'checked';
print "$text{'acl_unix'} \n";
printf " $text{'yes'}\n",
$o->{'unix'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'unix'} ? '' : 'checked';
print " $text{'acl_sessions'} \n";
printf " $text{'yes'}\n",
$o->{'sessions'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'sessions'} ? '' : 'checked';
print "$text{'acl_switch'} \n";
printf " $text{'yes'}\n",
$o->{'switch'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'switch'} ? '' : 'checked';
print " $text{'acl_times'} \n";
printf " $text{'yes'}\n",
$o->{'times'} ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'times'} ? '' : 'checked';
print " \n";
print " \n";
print " $text{'acl_groups'} \n";
printf " $text{'yes'}\n",
$o->{'groups'} == 1 ? 'checked' : '';
printf " $text{'no'} \n",
$o->{'groups'} == 0 ? 'checked' : '';
print "$text{'acl_gassign'} \n";
printf " %s\n",
$o->{'gassign'} eq '*' ? 'checked' : '', $text{'acl_gall'};
printf " %s \n",
$o->{'gassign'} eq '*' ? '' : 'checked', $text{'acl_gsel'};
print "\n";
map { $gcan{$_}++ } split(/\s+/, $o->{'gassign'});
printf "<%s>\n",
$gcan{'_none'} ? 'selected' : '', $text{'acl_gnone'};
foreach $g (&list_groups()) {
printf " %s\n",
$gcan{$g->{'name'}} ? 'selected' : '', $g->{'name'};
}
print " \n";
}
# acl_security_save(&options)
# Parse the form for security options for the acl module
sub acl_security_save
{
if ($in{'users_def'} == 1) {
$_[0]->{'users'} = '*';
}
elsif ($in{'users_def'} == 2) {
$_[0]->{'users'} = '~';
}
else {
$_[0]->{'users'} = join(" ", split(/\0/, $in{'users'}));
}
$_[0]->{'mode'} = $in{'mode'};
$_[0]->{'mods'} = $in{'mode'} == 2 ? join(" ", split(/\0/, $in{'mods'}))
: undef;
$_[0]->{'create'} = $in{'create'};
$_[0]->{'groups'} = $in{'groups'};
$_[0]->{'delete'} = $in{'delete'};
$_[0]->{'rename'} = $in{'rename'};
$_[0]->{'acl'} = $in{'acl'};
$_[0]->{'others'} = $in{'others'};
$_[0]->{'cert'} = $in{'cert'};
$_[0]->{'chcert'} = $in{'chcert'};
$_[0]->{'lang'} = $in{'lang'};
$_[0]->{'perms'} = $in{'perms'};
$_[0]->{'gassign'} = $in{'gassign_def'} ? '*' :
join(" ", split(/\0/, $in{'gassign'}));
$_[0]->{'sync'} = $in{'sync'};
$_[0]->{'unix'} = $in{'unix'};
$_[0]->{'switch'} = $in{'switch'};
$_[0]->{'sessions'} = $in{'sessions'};
$_[0]->{'cats'} = $in{'cats'};
$_[0]->{'theme'} = $in{'theme'};
$_[0]->{'ips'} = $in{'ips'};
$_[0]->{'times'} = $in{'times'};
}