Fix to use proper API for ACL pages

[no-build]
This commit is contained in:
Ilia Ross
2026-04-23 22:07:13 +02:00
parent 19190a6f5b
commit 68aab1c057
17 changed files with 871 additions and 1570 deletions
+74 -106
View File
@@ -5,115 +5,84 @@ require 'apache-lib.pl';
# Output HTML for editing security options for the apache module # Output HTML for editing security options for the apache module
sub acl_security_form sub acl_security_form
{ {
print "<tr> <td valign=top rowspan=4><b>$text{'acl_virts'}</b></td>\n"; my ($o) = @_;
print "<td rowspan=4 valign=top>\n";
printf "<input type=radio name=virts_def value=1 %s> %s\n", my $conf = &get_config();
$_[0]->{'virts'} eq '*' ? 'checked' : '', $text{'acl_vall'}; my @virts = ( { 'value' => '__default__' },
printf "<input type=radio name=virts_def value=0 %s> %s<br>\n", &find_directive_struct("VirtualHost", $conf) );
$_[0]->{'virts'} eq '*' ? '' : 'checked', $text{'acl_vsel'}; my @vsel = $o->{'virts'} eq '*' ? () : split(/\s+/, $o->{'virts'});
print "<select name=virts multiple size=5>\n"; my %vcan = map { $_, 1 } @vsel;
local $conf = &get_config(); my @vopts;
local @virts = ( { 'value' => '__default__' }, foreach my $v (@virts) {
&find_directive_struct("VirtualHost", $conf) ); my @vn = &virt_acl_name($v);
local %vcan = map { $_, 1 } split(/\s+/, $_[0]->{'virts'}); my ($can) = grep { $vcan{$_} } @vn;
local $v; my $show = $can || $vn[0];
foreach $v (@virts) { push(@vopts, [ $show,
local @vn = &virt_acl_name($v); $show eq "__default__" ? $text{'acl_defserv'}
local ($can) = grep { $vcan{$_} } @vn; : $show ]);
local $vn = $can || $vn[0];
printf "<option value=\"%s\" %s>%s</option>\n",
$vn, $can ? "selected" : "",
$vn eq "__default__" ? $text{'acl_defserv'} : $vn;
delete($vcan{$can}) if ($can); delete($vcan{$can}) if ($can);
} }
foreach $vn (keys %vcan) { print &ui_table_row($text{'acl_virts'},
next if ($vn eq "*"); &ui_radio("virts_def", $o->{'virts'} eq '*' ? 1 : 0,
printf "<option value=\"%s\" %s>%s</option>\n", [ [ 1, $text{'acl_vall'} ],
$vn, "selected", [ 0, $text{'acl_vsel'} ] ])."<br>\n".
$vn eq "__default__" ? $text{'acl_defserv'} : $vn; &ui_select("virts", \@vsel, \@vopts, 5, 1, 1),
3);
print &ui_table_row($text{'acl_global'},
&ui_select("global",
defined($o->{'global'}) && $o->{'global'} ne '' ?
$o->{'global'} : 0,
[ [ 1, $text{'yes'} ],
[ 2, $text{'acl_htaccess'} ],
[ 0, $text{'no'} ] ]));
print &ui_table_row($text{'acl_create'},
&ui_yesno_radio("create", $o->{'create'}));
print &ui_table_row($text{'acl_vuser'},
&ui_yesno_radio("vuser", $o->{'vuser'}));
print &ui_table_row($text{'acl_vaddr'},
&ui_yesno_radio("vaddr", $o->{'vaddr'}));
print &ui_table_row($text{'acl_pipe'},
&ui_yesno_radio("pipe", $o->{'pipe'}));
print &ui_table_row($text{'acl_stop'},
&ui_yesno_radio("stop", $o->{'stop'}));
print &ui_table_row($text{'acl_apply'},
&ui_yesno_radio("apply", $o->{'apply'}));
print &ui_table_row($text{'acl_names'},
&ui_yesno_radio("names", $o->{'names'}));
print &ui_table_row($text{'acl_dir'},
&ui_textbox("dir", $o->{'dir'}, 30)." ".
&file_chooser_button("dir", 1),
3);
print &ui_table_row($text{'acl_aliasdir'},
&ui_textbox("aliasdir", $o->{'aliasdir'}, 30)." ".
&file_chooser_button("aliasdir", 1),
3);
my @typesel = $o->{'types'} eq '*' ? () : split(/\s+/, $o->{'types'});
my @typeopts;
for (my $i = 0; $text{"type_$i"}; $i++) {
push(@typeopts, [ $i, $text{"type_$i"} ]);
} }
print "</select></td>\n"; print &ui_table_row($text{'acl_types'},
&ui_radio("types_def", $o->{'types'} eq '*' ? 1 : 0,
[ [ 1, $text{'acl_all'} ],
[ 0, $text{'acl_sel'} ] ])."<br>\n".
&ui_select("types", \@typesel, \@typeopts, 5, 1),
3);
print "<td><b>$text{'acl_global'}</b></td> <td><select name=global>\n"; print &ui_table_row($text{'acl_dirs'},
printf "<option value=1 %s>$text{'yes'}</option>\n", &ui_radio("dirsmode", $o->{'dirsmode'},
$_[0]->{'global'} == 1 ? "selected" : ""; [ [ 0, $text{'acl_dirs0'} ],
printf "<option value=2 %s>$text{'acl_htaccess'}</option>\n", [ 1, $text{'acl_dirs1'} ],
$_[0]->{'global'} == 2 ? "selected" : ""; [ 2, $text{'acl_dirs2'} ] ])."<br>\n".
printf "<option value=0 %s>$text{'no'}</option></select></td> </tr>\n", &ui_textarea("dirs", join("\n", split(/\s+/, $o->{'dirs'})), 5, 50),
$_[0]->{'global'} == 0 ? "selected" : ""; 3);
print "<tr> <td><b>$text{'acl_create'}</b></td> <td>\n";
printf "<input type=radio name=create value=1 %s> $text{'yes'}\n",
$_[0]->{'create'} ? "checked" : "";
printf "<input type=radio name=create value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'create'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_vuser'}</b></td> <td>\n";
printf "<input type=radio name=vuser value=1 %s> $text{'yes'}\n",
$_[0]->{'vuser'} ? "checked" : "";
printf "<input type=radio name=vuser value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'vuser'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_vaddr'}</b></td> <td>\n";
printf "<input type=radio name=vaddr value=1 %s> $text{'yes'}\n",
$_[0]->{'vaddr'} ? "checked" : "";
printf "<input type=radio name=vaddr value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'vaddr'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_pipe'}</b></td> <td>\n";
printf "<input type=radio name=pipe value=1 %s> $text{'yes'}\n",
$_[0]->{'pipe'} ? "checked" : "";
printf "<input type=radio name=pipe value=0 %s> $text{'no'}</td>\n",
$_[0]->{'pipe'} ? "" : "checked";
print "<td><b>$text{'acl_stop'}</b></td> <td>\n";
printf "<input type=radio name=stop value=1 %s> $text{'yes'}\n",
$_[0]->{'stop'} ? "checked" : "";
printf "<input type=radio name=stop value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'stop'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_apply'}</b></td> <td>\n";
printf "<input type=radio name=apply value=1 %s> $text{'yes'}\n",
$_[0]->{'apply'} ? "checked" : "";
printf "<input type=radio name=apply value=0 %s> $text{'no'}</td>\n",
$_[0]->{'apply'} ? "" : "checked";
print "<td><b>$text{'acl_names'}</b></td> <td>\n";
printf "<input type=radio name=names value=1 %s> $text{'yes'}\n",
$_[0]->{'names'} ? "checked" : "";
printf "<input type=radio name=names value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'names'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_dir'}</b></td>\n";
printf "<td colspan=3><input name=dir size=30 value='%s'> %s</td> </tr>\n",
$_[0]->{'dir'}, &file_chooser_button("dir", 1);
print "<tr> <td><b>$text{'acl_aliasdir'}</b></td>\n";
printf "<td colspan=3><input name=aliasdir size=30 value='%s'> %s</td> </tr>\n",
$_[0]->{'aliasdir'}, &file_chooser_button("aliasdir", 1);
print "<tr> <td valign=top><b>$text{'acl_types'}</b></td>\n";
print "<td colspan=3>\n";
printf "<input type=radio name=types_def value=1 %s> $text{'acl_all'}&nbsp;\n",
$_[0]->{'types'} eq '*' ? "checked" : "";
printf "<input type=radio name=types_def value=0 %s> $text{'acl_sel'}<br>\n",
$_[0]->{'types'} eq '*' ? "" : "checked";
map { $types{$_}++ } split(/\s+/, $_[0]->{'types'});
print "<select name=types size=5 multiple>\n";
for($i=0; $text{"type_$i"}; $i++) {
printf "<option value=\"%d\" %s>%s</option>\n",
$i, $types{$i} ? "selected" : "", $text{"type_$i"};
}
print "</select></td> </tr>\n";
print "<tr> <td valign=top><b>$text{'acl_dirs'}</b></td>\n";
print "<td colspan=3>\n";
print &ui_radio("dirsmode", $_[0]->{'dirsmode'},
[ [ 0, $text{'acl_dirs0'} ],
[ 1, $text{'acl_dirs1'} ],
[ 2, $text{'acl_dirs2'} ] ]),"<br>\n";
print &ui_textarea("dirs", join("\n", split(/\s+/, $_[0]->{'dirs'})), 5, 50);
print "</td> </tr>\n";
} }
# acl_security_save(&options) # acl_security_save(&options)
@@ -141,4 +110,3 @@ $_[0]->{'names'} = $in{'names'};
$_[0]->{'dirsmode'} = $in{'dirsmode'}; $_[0]->{'dirsmode'} = $in{'dirsmode'};
$_[0]->{'dirs'} = join(" ", split(/\s+/, $in{'dirs'})); $_[0]->{'dirs'} = join(" ", split(/\s+/, $in{'dirs'}));
} }
+91 -170
View File
@@ -11,18 +11,10 @@ our (%config, %text, %in);
# Output HTML for editing security options for the bind8 module # Output HTML for editing security options for the bind8 module
sub acl_security_form sub acl_security_form
{ {
my $m = $_[0]->{'zones'} eq '*' ? 1 : my ($o) = @_;
$_[0]->{'zones'} =~ /^\!/ ? 2 : 0; my $m = $o->{'zones'} eq '*' ? 1 :
print "<tr> <td valign=top><b>$text{'acl_zones'}</b></td>\n"; $o->{'zones'} =~ /^\!/ ? 2 : 0;
print "<td colspan=3><table cellpadding=0 cellspacing=0> <tr><td valign=top>\n";
printf "<input type=radio name=zones_def value=1 %s> %s<br>\n",
$m == 1 ? 'checked' : '', $text{'acl_zall'};
printf "<input type=radio name=zones_def value=0 %s> %s<br>\n",
$m == 0 ? 'checked' : '', $text{'acl_zsel'};
printf "<input type=radio name=zones_def value=2 %s> %s</td>\n",
$m == 2 ? 'checked' : '', $text{'acl_znsel'};
print "<td><select name=zones multiple size=4 width=150>\n";
my $conf = &get_config(); my $conf = &get_config();
my @zones = grep { $_->{'value'} ne "." } my @zones = grep { $_->{'value'} ne "." }
&find("zone", $conf); &find("zone", $conf);
@@ -31,188 +23,117 @@ foreach my $v (@views) {
push(@zones, grep { $_->{'value'} ne "." } push(@zones, grep { $_->{'value'} ne "." }
&find("zone", $v->{'members'})); &find("zone", $v->{'members'}));
} }
my %zcan; my @zoneopts;
map { $zcan{$_}++ } split(/\s+/, $_[0]->{'zones'});
foreach my $z (sort { $a->{'value'} cmp $b->{'value'} } @zones) { foreach my $z (sort { $a->{'value'} cmp $b->{'value'} } @zones) {
printf "<option value='%s' %s>%s</option>\n", push(@zoneopts, [ $z->{'value'}, &arpa_to_ip($z->{'value'}) ]);
$z->{'value'},
$zcan{$z->{'value'}} ? "selected" : "",
&arpa_to_ip($z->{'value'});
} }
foreach my $v (sort { $a->{'value'} cmp $b->{'value'} } @views) { foreach my $v (sort { $a->{'value'} cmp $b->{'value'} } @views) {
printf "<option value='%s' %s>%s</option>\n", push(@zoneopts, [ 'view_'.$v->{'value'},
'view_'.$v->{'value'}, &text('acl_inview', $v->{'value'}) ]);
$zcan{'view_'.$v->{'value'}} ? "selected" : "",
&text('acl_inview', $v->{'value'});
} }
print "</select></td> </tr></table></td></tr>\n";
print &ui_table_row($text{'acl_zones'},
&ui_radio("zones_def", $m,
[ [ 1, $text{'acl_zall'} ],
[ 0, $text{'acl_zsel'} ],
[ 2, $text{'acl_znsel'} ] ])."<br>\n".
&ui_select("zones", [ split(/\s+/, $o->{'zones'}) ], \@zoneopts, 4, 1),
3);
if (@views) { if (@views) {
print "<tr> <td valign=top><b>$text{'acl_inviews'}</b></td>\n"; my @viewopts = [ "_", "&lt;".$text{'acl_toplevel'}."&gt;" ];
print "<td colspan=3>\n";
print &ui_radio("inviews_def", $_[0]->{'inviews'} eq "*" ? 1 : 0,
[ [ 1, $text{'acl_vall'} ],
[ 0, $text{'acl_vsel'} ] ]),"<br>\n";
print "<select name=inviews multiple size=4 width=150>\n";
my %vcan;
map { $vcan{$_}++ } split(/\s+/, $_[0]->{'inviews'});
printf "<option value='%s' %s>%s</option>\n",
"_", $vcan{"_"} ? "selected" : "",
"&lt;".$text{'acl_toplevel'}."&gt;";
foreach my $v (sort { $a->{'value'} cmp $b->{'value'} } @views) { foreach my $v (sort { $a->{'value'} cmp $b->{'value'} } @views) {
printf "<option value='%s' %s>%s</option>\n", push(@viewopts, [ $v->{'value'}, $v->{'value'} ]);
$v->{'value'},
$vcan{$v->{'value'}} ? "selected" : "", $v->{'value'};
} }
print "</select></td></tr>\n";
print &ui_table_row($text{'acl_inviews'},
&ui_radio("inviews_def", $o->{'inviews'} eq "*" ? 1 : 0,
[ [ 1, $text{'acl_vall'} ],
[ 0, $text{'acl_vsel'} ] ])."<br>\n".
&ui_select("inviews", [ split(/\s+/, $o->{'inviews'}) ], \@viewopts,
4, 1),
3);
} }
print "<tr> <td><b>$text{'acl_types'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_types'},
printf "<input type=radio name=types_def value=1 %s> %s\n", &ui_opt_textbox("types", $o->{'types'}, 40,
$_[0]->{'types'} ? "" : "checked", $text{'acl_types1'}; $text{'acl_types1'}, $text{'acl_types0'}),
printf "<input type=radio name=types_def value=0 %s> %s\n", 3);
$_[0]->{'types'} ? "checked" : "", $text{'acl_types0'};
printf "<input name=types size=40 value='%s'></td> </tr>\n",
$_[0]->{'types'};
print "<tr> <td valign=top><b>$text{'acl_dir'}</b></td>\n"; print &ui_table_row($text{'acl_dir'},
printf "<td colspan=3><input name=dir size=30 value='%s'> %s<br>\n", &ui_textbox("dir", $o->{'dir'}, 30)." ".&file_chooser_button("dir", 1).
$_[0]->{'dir'}, &file_chooser_button("dir", 1); "<br>\n".&ui_checkbox("dironly", 1, $text{'acl_dironly'}, $o->{'dironly'}),
printf "<input type=checkbox name=dironly value=1 %s> %s</td> </tr>\n", 3);
$_[0]->{'dironly'} ? "checked" : "", $text{'acl_dironly'};
print "<tr> <td><b>$text{'acl_defaults'}</b></td> <td nowrap>\n"; print &ui_table_row($text{'acl_defaults'},
printf "<input type=radio name=defaults value=1 %s> $text{'yes'}\n", &ui_yesno_radio("defaults", $o->{'defaults'}));
$_[0]->{'defaults'} ? "checked" : "";
printf "<input type=radio name=defaults value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'defaults'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_ztypes'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_ztypes'},
foreach my $t ("master", "slave", "forward", "delegation") { join("", map { &ui_checkbox($_, 1, $text{'acl_ztypes_'.$_}, $o->{$_}) }
printf "<input type=checkbox name=%s %s> %s\n", ("master", "slave", "forward", "delegation")),
$t, $_[0]->{$t} ? "checked" : "", $text{'acl_ztypes_'.$t}; 3);
}
print "</td> </tr>\n";
print "<tr> <td><b>$text{'acl_reverse'}</b></td> <td nowrap>\n"; print &ui_table_row($text{'acl_reverse'},
printf "<input type=radio name=reverse value=1 %s> $text{'yes'}\n", &ui_yesno_radio("reverse", $o->{'reverse'}));
$_[0]->{'reverse'} ? "checked" : ""; print &ui_table_row($text{'acl_multiple'},
printf "<input type=radio name=reverse value=0 %s> $text{'no'}</td>\n", &ui_yesno_radio("multiple", $o->{'multiple'}));
$_[0]->{'reverse'} ? "" : "checked";
print "<td><b>$text{'acl_multiple'}</b></td> <td nowrap>\n"; print &ui_table_row($text{'acl_ro'},
printf "<input type=radio name=multiple value=1 %s> $text{'yes'}\n", &ui_yesno_radio("ro", $o->{'ro'}));
$_[0]->{'multiple'} ? "checked" : ""; print &ui_table_row($text{'acl_apply'},
printf "<input type=radio name=multiple value=0 %s> $text{'no'}</td> </tr>\n", &ui_select("apply",
$_[0]->{'multiple'} ? "" : "checked"; defined($o->{'apply'}) && $o->{'apply'} ne '' ? $o->{'apply'} : 0,
[ [ 1, $text{'yes'} ],
[ 2, $text{'acl_applyonly'} ],
[ 3, $text{'acl_applygonly'} ],
[ 0, $text{'no'} ] ]));
print "<tr> <td><b>$text{'acl_ro'}</b></td> <td nowrap>\n"; print &ui_table_row($text{'acl_file'},
printf "<input type=radio name=ro value=1 %s> $text{'yes'}\n", &ui_yesno_radio("file", $o->{'file'}));
$_[0]->{'ro'} ? "checked" : ""; print &ui_table_row($text{'acl_params'},
printf "<input type=radio name=ro value=0 %s> $text{'no'}</td>\n", &ui_yesno_radio("params", $o->{'params'}));
$_[0]->{'ro'} ? "" : "checked";
print "<td><b>$text{'acl_apply'}</b></td> <td nowrap>\n"; print &ui_table_row($text{'acl_opts'},
print &ui_select("apply", $_[0]->{'apply'}, &ui_yesno_radio("opts", $o->{'opts'}));
[ [ 1, $text{'yes'} ], print &ui_table_row($text{'acl_delete'},
[ 2, $text{'acl_applyonly'} ], &ui_yesno_radio("delete", $o->{'delete'}));
[ 3, $text{'acl_applygonly'} ],
[ 0, $text{'no'} ] ]),"</td> </tr>\n";
print "<tr> <td><b>$text{'acl_file'}</b></td> <td nowrap>\n"; print &ui_table_row($text{'acl_gen'},
printf "<input type=radio name=file value=1 %s> $text{'yes'}\n", &ui_yesno_radio("gen", $o->{'gen'}));
$_[0]->{'file'} ? "checked" : ""; print &ui_table_row($text{'acl_whois'},
printf "<input type=radio name=file value=0 %s> $text{'no'}</td>\n", &ui_yesno_radio("whois", $o->{'whois'}));
$_[0]->{'file'} ? "" : "checked";
print "<td><b>$text{'acl_params'}</b></td> <td nowrap>\n"; print &ui_table_row($text{'acl_findfree'},
printf "<input type=radio name=params value=1 %s> $text{'yes'}\n", &ui_yesno_radio("findfree", $o->{'findfree'}));
$_[0]->{'params'} ? "checked" : ""; print &ui_table_row($text{'acl_remote'},
printf "<input type=radio name=params value=0 %s> $text{'no'}</td> </tr>\n", &ui_yesno_radio("remote", $o->{'remote'}));
$_[0]->{'params'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_opts'}</b></td> <td nowrap>\n"; print &ui_table_row($text{'acl_slaves'},
printf "<input type=radio name=opts value=1 %s> $text{'yes'}\n", &ui_yesno_radio("slaves", $o->{'slaves'}));
$_[0]->{'opts'} ? "checked" : ""; print &ui_table_row($text{'acl_dnssec'},
printf "<input type=radio name=opts value=0 %s> $text{'no'}</td>\n", &ui_yesno_radio("dnssec", $o->{'dnssec'}));
$_[0]->{'opts'} ? "" : "checked";
print "<td><b>$text{'acl_delete'}</b></td> <td nowrap>\n"; print &ui_table_row($text{'acl_views'},
printf "<input type=radio name=delete value=1 %s> $text{'yes'}\n", &ui_radio("views", defined($o->{'views'}) ? $o->{'views'} : 0,
$_[0]->{'delete'} ? "checked" : ""; [ [ 1, $text{'yes'} ],
printf "<input type=radio name=delete value=0 %s> $text{'no'}</td> </tr>\n", [ 2, $text{'acl_edonly'} ],
$_[0]->{'delete'} ? "" : "checked"; [ 0, $text{'no'} ] ]),
3);
print "<tr> <td><b>$text{'acl_gen'}</b></td> <td nowrap>\n";
printf "<input type=radio name=gen value=1 %s> $text{'yes'}\n",
$_[0]->{'gen'} ? "checked" : "";
printf "<input type=radio name=gen value=0 %s> $text{'no'}</td>\n",
$_[0]->{'gen'} ? "" : "checked";
print "<td><b>$text{'acl_whois'}</b></td> <td nowrap>\n";
printf "<input type=radio name=whois value=1 %s> $text{'yes'}\n",
$_[0]->{'whois'} ? "checked" : "";
printf "<input type=radio name=whois value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'whois'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_findfree'}</b></td> <td nowrap>\n";
printf "<input type=radio name=findfree value=1 %s> $text{'yes'}\n",
$_[0]->{'findfree'} ? "checked" : "";
printf "<input type=radio name=findfree value=0 %s> $text{'no'}</td>\n",
$_[0]->{'findfree'} ? "" : "checked";
print "<td><b>$text{'acl_remote'}</b></td> <td nowrap>\n";
printf "<input type=radio name=remote value=1 %s> $text{'yes'}\n",
$_[0]->{'remote'} ? "checked" : "";
printf "<input type=radio name=remote value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'remote'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_slaves'}</b></td> <td nowrap>\n";
printf "<input type=radio name=slaves value=1 %s> $text{'yes'}\n",
$_[0]->{'slaves'} ? "checked" : "";
printf "<input type=radio name=slaves value=0 %s> $text{'no'}</td>\n",
$_[0]->{'slaves'} ? "" : "checked";
print "<td><b>$text{'acl_dnssec'}</b></td> <td nowrap>\n";
printf "<input type=radio name=dnssec value=1 %s> $text{'yes'}\n",
$_[0]->{'dnssec'} ? "checked" : "";
printf "<input type=radio name=dnssec value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'dnssec'} ? "" : "checked";
print "</tr>\n";
print "<tr> <td><b>$text{'acl_views'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=views value=1 %s> $text{'yes'}\n",
$_[0]->{'views'} == 1 ? "checked" : "";
printf "<input type=radio name=views value=2 %s> $text{'acl_edonly'}\n",
$_[0]->{'views'} == 2 ? "checked" : "";
printf "<input type=radio name=views value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'views'} ? "" : "checked";
if (@views) { if (@views) {
my $m = $_[0]->{'vlist'} eq '*' ? 1 : my $vm = $o->{'vlist'} eq '*' ? 1 :
$_[0]->{'vlist'} =~ /^\!/ ? 2 : $o->{'vlist'} =~ /^\!/ ? 2 :
$_[0]->{'vlist'} eq '' ? 3 : 0; $o->{'vlist'} eq '' ? 3 : 0;
print "<tr> <td valign=top><b>$text{'acl_vlist'}</b></td>\n"; my @vopts = map { [ $_->{'value'}, $_->{'value'} ] }
print "<td colspan=3><table cellpadding=0 cellspacing=0> <tr><td valign=top>\n"; sort { $a->{'value'} cmp $b->{'value'} } @views;
printf "<input type=radio name=vlist_def value=1 %s> %s<br>\n", print &ui_table_row($text{'acl_vlist'},
$m == 1 ? 'checked' : '', $text{'acl_vall'}; &ui_radio("vlist_def", $vm,
printf "<input type=radio name=vlist_def value=0 %s> %s<br>\n", [ [ 1, $text{'acl_vall'} ],
$m == 0 ? 'checked' : '', $text{'acl_vsel'}; [ 0, $text{'acl_vsel'} ],
printf "<input type=radio name=vlist_def value=2 %s> %s<br>\n", [ 2, $text{'acl_vnsel'} ],
$m == 2 ? 'checked' : '', $text{'acl_vnsel'}; [ 3, $text{'acl_vnone'} ] ])."<br>\n".
printf "<input type=radio name=vlist_def value=3 %s> %s</td>\n", &ui_select("vlist", [ split(/\s+/, $o->{'vlist'}) ], \@vopts, 4, 1),
$m == 3 ? 'checked' : '', $text{'acl_vnone'}; 3);
print "<td><select name=vlist multiple size=4 width=150>\n";
my ($v, %vcan);
map { $vcan{$_}++ } split(/\s+/, $_[0]->{'vlist'});
foreach my $v (sort { $a->{'value'} cmp $b->{'value'} } @views) {
printf "<option value='%s' %s>%s</option>\n",
$v->{'value'},
$vcan{$v->{'value'}} ? "selected" : "", $v->{'value'};
}
print "</select></td> </tr></table></td></tr>\n";
} }
} }
+37 -56
View File
@@ -5,66 +5,47 @@ require 'cluster-passwd-lib.pl';
# Output HTML for editing security options for the passwd module # Output HTML for editing security options for the passwd module
sub acl_security_form sub acl_security_form
{ {
print "<tr> <td valign=top><b>$passwd::text{'acl_users'}</b></td> <td colspan=3>\n"; my ($o) = @_;
printf "<input type=radio name=mode value=0 %s> %s\n",
$_[0]->{'mode'} == 0 ? 'checked' : '', $passwd::text{'acl_mode0'};
printf "<input type=radio name=mode value=3 %s> %s<br>\n", print &ui_table_row($passwd::text{'acl_users'},
$_[0]->{'mode'} == 3 ? 'checked' : '', $passwd::text{'acl_mode3'}; &ui_radio_table("mode", defined($o->{'mode'}) ? $o->{'mode'} : 0,
[ [ 0, $passwd::text{'acl_mode0'} ],
[ 3, $passwd::text{'acl_mode3'} ],
[ 1, $passwd::text{'acl_mode1'},
&ui_textbox("users1", $o->{'mode'} == 1 ? $o->{'users'} : "",
40)." ".&user_chooser_button("users1", 1) ],
[ 2, $passwd::text{'acl_mode2'},
&ui_textbox("users2", $o->{'mode'} == 2 ? $o->{'users'} : "",
40)." ".&user_chooser_button("users2", 1) ],
[ 4, $passwd::text{'acl_mode4'},
&ui_textbox("low", $o->{'mode'} == 4 ? $o->{'low'} : "", 8).
" - ".&ui_textbox("high",
$o->{'mode'} == 4 ? $o->{'high'} : "", 8) ],
[ 5, $passwd::text{'acl_mode5'},
&ui_textbox("groups", $o->{'mode'} == 5 ? $o->{'users'} : "",
20)." ".&group_chooser_button("groups", 1)."<br>\n".
&ui_checkbox("sec", 1, $passwd::text{'acl_sec'}, $o->{'sec'}) ],
[ 6, $passwd::text{'acl_mode6'},
&ui_textbox("match", $o->{'mode'} == 6 ? $o->{'users'} : "",
15) ] ], 1),
3);
printf "<input type=radio name=mode value=1 %s> %s\n", print &ui_table_row($passwd::text{'acl_repeat'},
$_[0]->{'mode'} == 1 ? 'checked' : '', $passwd::text{'acl_mode1'}; &ui_yesno_radio("repeat", $o->{'repeat'}), 3);
printf "<input name=users1 size=40 value='%s'> %s<br>\n",
$_[0]->{'mode'} == 1 ? $_[0]->{'users'} : '',
&user_chooser_button("users1", 1);
printf "<input type=radio name=mode value=2 %s> %s\n", print &ui_table_row($passwd::text{'acl_others'},
$_[0]->{'mode'} == 2 ? 'checked' : '', $passwd::text{'acl_mode2'}; &ui_radio("others", defined($o->{'others'}) ? $o->{'others'} : 0,
printf "<input name=users2 size=40 value='%s'> %s<br>\n", [ [ 1, $passwd::text{'yes'} ],
$_[0]->{'mode'} == 2 ? $_[0]->{'users'} : '', [ 2, $passwd::text{'acl_opt'} ],
&user_chooser_button("users2", 1); [ 0, $passwd::text{'no'} ] ]),
3);
printf "<input type=radio name=mode value=4 %s> %s\n", print &ui_table_row($passwd::text{'acl_old'},
$_[0]->{'mode'} == 4 ? 'checked' : '', $passwd::text{'acl_mode4'}; &ui_radio("old", defined($o->{'old'}) ? $o->{'old'} : 0,
printf "<input name=low size=8 value='%s'> -\n", [ [ 1, $passwd::text{'yes'} ],
$_[0]->{'mode'} == 4 ? $_[0]->{'low'} : ''; [ 2, $passwd::text{'acl_old_this'} ],
printf "<input name=high size=8 value='%s'><br>\n", [ 0, $passwd::text{'no'} ] ]),
$_[0]->{'mode'} == 4 ? $_[0]->{'high'} : ''; 3);
printf "<input type=radio name=mode value=5 %s> %s\n",
$_[0]->{'mode'} == 5 ? 'checked' : '', $passwd::text{'acl_mode5'};
printf "<input name=groups size=20 value='%s'> %s<br>\n",
$_[0]->{'mode'} == 5 ? $_[0]->{'users'} : '',
&group_chooser_button("groups", 1);
printf "%s <input type=checkbox name=sec value=1 %s> %s<br>\n",
"&nbsp;" x 5, $_[0]->{'sec'} ? 'checked' : '',$passwd::text{'acl_sec'};
printf "<input type=radio name=mode value=6 %s> %s\n",
$_[0]->{'mode'} == 6 ? 'checked' : '', $passwd::text{'acl_mode6'};
printf "<input name=match size=15 value='%s'></td> </tr>\n",
$_[0]->{'mode'} == 6 ? $_[0]->{'users'} : '';
print "<tr> <td><b>$passwd::text{'acl_repeat'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=repeat value=1 %s> $passwd::text{'yes'}\n",
$_[0]->{'repeat'} ? "checked" : "";
printf "<input type=radio name=repeat value=0 %s> $passwd::text{'no'}</td> </tr>\n",
$_[0]->{'repeat'} ? "" : "checked";
print "<td><b>$passwd::text{'acl_others'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=others value=1 %s> $passwd::text{'yes'}\n",
$_[0]->{'others'} == 1 ? "checked" : "";
printf "<input type=radio name=others value=2 %s> $passwd::text{'acl_opt'}\n",
$_[0]->{'others'} == 2 ? "checked" : "";
printf "<input type=radio name=others value=0 %s> $passwd::text{'no'}</td> </tr>\n",
$_[0]->{'others'} == 0 ? "checked" : "";
print "<tr> <td><b>$passwd::text{'acl_old'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=old value=1 %s> $passwd::text{'yes'}\n",
$_[0]->{'old'} == 1 ? "checked" : "";
printf "<input type=radio name=old value=2 %s> $passwd::text{'acl_old_this'}\n",
$_[0]->{'old'} == 2 ? "checked" : "";
printf "<input type=radio name=old value=0 %s> $passwd::text{'no'}</td> </tr>\n",
$_[0]->{'old'} == 0 ? "checked" : "";
} }
# acl_security_save(&options) # acl_security_save(&options)
+5 -3
View File
@@ -5,9 +5,11 @@ require 'dfsadmin-lib.pl';
# Output HTML for editing security options for the format module # Output HTML for editing security options for the format module
sub acl_security_form sub acl_security_form
{ {
print "<tr> <td><b>$text{'acl_view'}</b></td>\n"; my ($o) = @_;
print "<td>",&ui_radio("view", $access{'view'},
[ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]),"</td> </tr>\n"; print &ui_table_row($text{'acl_view'},
&ui_radio("view", $o->{'view'},
[ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]));
} }
# acl_security_save(&options) # acl_security_save(&options)
+45 -174
View File
@@ -5,164 +5,53 @@ require 'dhcpd-lib.pl';
# Output HTML for editing security options for the dhcpd module # Output HTML for editing security options for the dhcpd module
sub acl_security_form sub acl_security_form
{ {
print "<tr>\n<td><b>$text{'acl_apply'}</b></td> <td>\n"; my ($o) = @_;
printf "<input type=radio name=apply value=1 %s> $text{'yes'}\n",
$_[0]->{'apply'} ? "checked" : "";
printf "<input type=radio name=apply value=0 %s> $text{'no'}</td>\n",
$_[0]->{'apply'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_global'}</b></td> <td>\n"; foreach my $f ('apply', 'global', 'r_leases', 'w_leases', 'zones') {
printf "<input type=radio name=global value=1 %s> $text{'yes'}\n", print &ui_table_row($text{'acl_'.$f},
$_[0]->{'global'} ? "checked" : ""; &ui_yesno_radio($f, $o->{$f}));
printf "<input type=radio name=global value=0 %s> $text{'no'}</td>\n", }
$_[0]->{'global'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_r_leases'}</b></td> <td>\n"; print &ui_table_hr();
printf "<input type=radio name=r_leases value=1 %s> $text{'yes'}\n",
$_[0]->{'r_leases'} ? "checked" : "";
printf "<input type=radio name=r_leases value=0 %s> $text{'no'}</td>\n",
$_[0]->{'r_leases'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_w_leases'}</b></td> <td>\n"; foreach my $f ('uniq_hst', 'uniq_sub', 'uniq_sha') {
printf "<input type=radio name=w_leases value=1 %s> $text{'yes'}\n", print &ui_table_row($text{'acl_'.$f},
$_[0]->{'w_leases'} ? "checked" : ""; &ui_yesno_radio($f, $o->{$f}));
printf "<input type=radio name=w_leases value=0 %s> $text{'no'}</td>\n", }
$_[0]->{'w_leases'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_zones'}</b></td> <td>\n"; print &ui_table_hr();
printf "<input type=radio name=zones value=1 %s> $text{'yes'}\n",
$_[0]->{'zones'} ? "checked" : "";
printf "<input type=radio name=zones value=0 %s> $text{'no'}</td>\n",
$_[0]->{'zones'} ? "" : "checked";
print "</tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n"; print &ui_table_row($text{'acl_seclevel'},
&ui_radio("smode", defined($o->{'smode'}) ? $o->{'smode'} : 0,
[ map { [ $_, $_ ] } 0 .. 3 ]),
3);
# uniqs print &ui_table_row($text{'acl_hide'},
print "<tr>\n<td><b>$text{'acl_uniq_hst'}</b></td> <td>\n"; &ui_yesno_radio("hide", defined($o->{'hide'}) ? $o->{'hide'} : 0));
printf "<input type=radio name=uniq_hst value=1 %s> $text{'yes'}\n",
$_[0]->{'uniq_hst'} ? "checked" : "";
printf "<input type=radio name=uniq_hst value=0 %s> $text{'no'}</td>\n",
$_[0]->{'uniq_hst'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_uniq_sub'}</b></td> <td>\n"; print &ui_table_hr();
printf "<input type=radio name=uniq_sub value=1 %s> $text{'yes'}\n",
$_[0]->{'uniq_sub'} ? "checked" : "";
printf "<input type=radio name=uniq_sub value=0 %s> $text{'no'}</td>\n",
$_[0]->{'uniq_sub'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_uniq_sha'}</b></td> <td>\n"; foreach my $type (['hst', 'acl_ahst'], ['grp', 'acl_agrp'],
printf "<input type=radio name=uniq_sha value=1 %s> $text{'yes'}\n", ['sub', 'acl_asub'], ['sha', 'acl_asha']) {
$_[0]->{'uniq_sha'} ? "checked" : ""; print &ui_table_row($text{$type->[1]},
printf "<input type=radio name=uniq_sha value=0 %s> $text{'no'}</td>\n", join("", map { &ui_checkbox($_."_".$type->[0], 1,
$_[0]->{'uniq_sha'} ? "" : "checked"; $text{"acl_".$_},
print "</tr>\n"; $o->{$_."_".$type->[0]}) }
qw(c r w)),
3);
}
print "<tr> <td colspan=4><hr></td> </tr>\n"; print &ui_table_hr();
# security mode settings foreach my $f ('per_sub_acls', 'per_sha_acls',
print "<tr>\n<td><b>$text{'acl_seclevel'}</b></td> <td colspan=3>\n"; 'per_hst_acls', 'per_grp_acls') {
printf "<input type=radio name=smode value=0 %s> 0\n", print &ui_table_row($text{'acl_'.$f},
$_[0]->{'smode'} == 0 ? "checked" : ""; &ui_yesno_radio($f, $o->{$f}));
printf "<input type=radio name=smode value=1 %s> 1\n", }
$_[0]->{'smode'} == 1 ? "checked" : "";
printf "<input type=radio name=smode value=2 %s> 2\n",
$_[0]->{'smode'} == 2 ? "checked" : "";
printf "<input type=radio name=smode value=3 %s> 3\n",
$_[0]->{'smode'} == 3 ? "checked" : "";
print "</td>\n</tr>\n";
print "<tr>\n<td><b>$text{'acl_hide'}</b></td> <td>\n"; print &ui_table_hr();
printf "<input type=radio name=hide value=1 %s> $text{'yes'}\n", print &ui_table_span($text{'acl_per_obj_acls'});
$_[0]->{'hide'} == 1 ? "checked" : ""; &display_tree($o, &get_parent_config(), -2);
printf "<input type=radio name=hide value=0 %s> $text{'no'}</td>\n",
$_[0]->{'hide'} == 0 ? "checked" : "";
print "</tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n";
# global acls
print "<tr>\n<td><b>$text{'acl_ahst'}</b></td>\n";
print "<td colspan=3>\n";
printf "<input type=checkbox name=c_hst value=1 %s> %s\n",
$_[0]->{'c_hst'} ? "checked" : "", $text{"acl_c"};
printf "<input type=checkbox name=r_hst value=1 %s> %s\n",
$_[0]->{'r_hst'} ? "checked" : "", $text{"acl_r"};
printf "<input type=checkbox name=w_hst value=1 %s> %s\n",
$_[0]->{'w_hst'} ? "checked" : "", $text{"acl_w"};
print "</td> </tr>\n";
print "<tr>\n<td><b>$text{'acl_agrp'}</b></td>\n";
print "<td colspan=3>\n";
printf "<input type=checkbox name=c_grp value=1 %s> %s\n",
$_[0]->{'c_grp'} ? "checked" : "", $text{"acl_c"};
printf "<input type=checkbox name=r_grp value=1 %s> %s\n",
$_[0]->{'r_grp'} ? "checked" : "", $text{"acl_r"};
printf "<input type=checkbox name=w_grp value=1 %s> %s\n",
$_[0]->{'w_grp'} ? "checked" : "", $text{"acl_w"};
print "</td> </tr>\n";
print "<tr>\n<td><b>$text{'acl_asub'}</b></td>\n";
print "<td colspan=3>\n";
printf "<input type=checkbox name=c_sub value=1 %s> %s\n",
$_[0]->{'c_sub'} ? "checked" : "", $text{"acl_c"};
printf "<input type=checkbox name=r_sub value=1 %s> %s\n",
$_[0]->{'r_sub'} ? "checked" : "", $text{"acl_r"};
printf "<input type=checkbox name=w_sub value=1 %s> %s\n",
$_[0]->{'w_sub'} ? "checked" : "", $text{"acl_w"};
print "</td> </tr>\n";
print "<tr>\n<td><b>$text{'acl_asha'}</b></td>\n";
print "<td colspan=3>\n";
printf "<input type=checkbox name=c_sha value=1 %s> %s\n",
$_[0]->{'c_sha'} ? "checked" : "", $text{"acl_c"};
printf "<input type=checkbox name=r_sha value=1 %s> %s\n",
$_[0]->{'r_sha'} ? "checked" : "", $text{"acl_r"};
printf "<input type=checkbox name=w_sha value=1 %s> %s\n",
$_[0]->{'w_sha'} ? "checked" : "", $text{"acl_w"};
print "</td> </tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n";
# per-subnet and per-host acls
print "<tr><td><b>$text{'acl_per_sub_acls'}</b></td> <td>\n";
printf "<input type=radio name=per_sub_acls value=1 %s> $text{'yes'}\n",
$_[0]->{'per_sub_acls'} ? "checked" : "";
printf "<input type=radio name=per_sub_acls value=0 %s> $text{'no'}\n",
$_[0]->{'per_sub_acls'} ? "" : "checked";
print "</td></tr>\n";
print "<tr><td><b>$text{'acl_per_sha_acls'}</b></td> <td>\n";
printf "<input type=radio name=per_sha_acls value=1 %s> $text{'yes'}\n",
$_[0]->{'per_sha_acls'} ? "checked" : "";
printf "<input type=radio name=per_sha_acls value=0 %s> $text{'no'}\n",
$_[0]->{'per_sha_acls'} ? "" : "checked";
print "</td></tr>\n";
print "<tr><td><b>$text{'acl_per_hst_acls'}</b></td> <td>\n";
printf "<input type=radio name=per_hst_acls value=1 %s> $text{'yes'}\n",
$_[0]->{'per_hst_acls'} ? "checked" : "";
printf "<input type=radio name=per_hst_acls value=0 %s> $text{'no'}\n",
$_[0]->{'per_hst_acls'} ? "" : "checked";
print "</td></tr>\n";
print "<tr><td><b>$text{'acl_per_grp_acls'}</b></td> <td>\n";
printf "<input type=radio name=per_grp_acls value=1 %s> $text{'yes'}\n",
$_[0]->{'per_grp_acls'} ? "checked" : "";
printf "<input type=radio name=per_grp_acls value=0 %s> $text{'no'}\n",
$_[0]->{'per_grp_acls'} ? "" : "checked";
print "</td></tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n";
print "<tr>\n<td $tb><b>$text{'acl_per_obj_acls'}</b></td></tr> \n";
&display_tree($_[0],&get_parent_config(),-2);
} }
# acl_security_save(&options) # acl_security_save(&options)
@@ -254,36 +143,18 @@ if (!$name && $node->{'name'} eq 'group') {
} }
local $nodetype=$onames{$node->{'name'}}; local $nodetype=$onames{$node->{'name'}};
local $aclname='ACL'.$nodetype.'_'.$name; local $aclname='ACL'.$nodetype.'_'.$name;
print "<tr>\n<td>","&nbsp"x$padding,
" $node->{'name'}: <b>$name</b></td>\n";
if (($nodetype eq 'hst')||($nodetype eq 'sub')|| if (($nodetype eq 'hst')||($nodetype eq 'sub')||
($nodetype eq 'grp')||($nodetype eq 'sha')) { ($nodetype eq 'grp')||($nodetype eq 'sha')) {
print "<td colspan=3>\n"; my $sel = !$acc->{$aclname} || !&perm_to('r', $nodetype, $acc, $name) ? '' :
if($acc->{$aclname}) { &perm_to('rw', $nodetype, $acc, $name) ? 'rw' : 'r';
printf "<input type=radio name=$aclname value='' %s> %s\n", print &ui_table_row(
!&perm_to('r',$nodetype,$acc,$name) ? ("&nbsp;" x $padding)." ".$node->{'name'}.": <b>$name</b>",
"checked" : "", $text{"acl_na"}; &ui_radio($aclname, $sel,
printf "<input type=radio name=$aclname value='r' %s> %s\n", [ [ '', $text{'acl_na'} ],
&perm_to('r',$nodetype,$acc,$name) && [ 'r', $text{'acl_r1'} ],
!&perm_to('rw',$nodetype,$acc,$name) ? [ 'rw', $text{'acl_rw'} ] ]),
"checked" : "",$text{"acl_r1"}; 3);
printf "<input type=radio name=$aclname value='rw' %s> %s\n",
&perm_to('rw',$nodetype,$acc,$name) ?
"checked" : "", $text{"acl_rw"};
}
else {
printf "<input type=radio name=$aclname value='' checked> %s\n",
$text{"acl_na"};
printf "<input type=radio name=$aclname value='r'> %s\n",
$text{"acl_r1"};
printf "<input type=radio name=$aclname value='rw'> %s\n",
$text{"acl_rw"};
}
print "</td>\n";
} }
print "</tr>\n";
} }
1; 1;
+15 -18
View File
@@ -5,27 +5,24 @@ require 'format-lib.pl';
# Output HTML for editing security options for the format module # Output HTML for editing security options for the format module
sub acl_security_form sub acl_security_form
{ {
local @dlist = &list_disks(); my ($o) = @_;
local ($d, %dcan); my @dlist = &list_disks();
map { $dcan{$_}++ } split(/\s+/, $_[0]->{'disks'}); my @dopts;
print "<tr> <td valign=top><b>$text{'acl_disks'}</b></td> <td>\n"; foreach my $d (@dlist) {
printf "<input type=radio name=disks_def value=1 %s> %s\n",
$_[0]->{'disks'} eq '*' ? 'checked' : '', $text{'acl_dall'};
printf "<input type=radio name=disks_def value=0 %s> %s<br>\n",
$_[0]->{'disks'} eq '*' ? '' : 'checked', $text{'acl_dsel'};
print "<select name=disks size=4 multiple>\n";
foreach $d (@dlist) {
$d->{'device'} =~ s/^.*\///; $d->{'device'} =~ s/^.*\///;
printf "<option value='%s' %s>%s</option>\n", push(@dopts, [ $d->{'device'}, "$d->{'desc'} ($d->{'type'})" ]);
$d->{'device'},
$dcan{$d->{'device'}} ? "selected" : "",
"$d->{'desc'} ($d->{'type'})";
} }
print "</select></td> </tr>\n";
print "<tr> <td><b>$text{'acl_view'}</b></td>\n"; print &ui_table_row($text{'acl_disks'},
print "<td>",&ui_radio("view", $access{'view'}, &ui_radio("disks_def", $o->{'disks'} eq '*' ? 1 : 0,
[ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]),"</td> </tr>\n"; [ [ 1, $text{'acl_dall'} ],
[ 0, $text{'acl_dsel'} ] ])."<br>\n".
&ui_select("disks", [ split(/\s+/, $o->{'disks'}) ], \@dopts, 4, 1),
3);
print &ui_table_row($text{'acl_view'},
&ui_radio("view", $o->{'view'},
[ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]));
} }
# acl_security_save(&options) # acl_security_save(&options)
+69 -89
View File
@@ -7,102 +7,82 @@ require 'ldap-useradmin-lib.pl';
sub acl_security_form sub acl_security_form
{ {
local $o = $_[0]; local $o = $_[0];
my $uedit_group = $o->{'uedit_mode'} == 5 ?
join(" ", map { "".getgrgid($_) } split(/\s+/, $o->{'uedit'})) : "";
print "<tr> <td valign=top><b>$text{'acl_uedit'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_uedit'},
printf "<input type=radio name=uedit_mode value=0 %s> $text{'acl_uedit_all'}&nbsp;&nbsp;\n", &ui_radio_table("uedit_mode",
$o->{'uedit_mode'} == 0 ? "checked" : ""; defined($o->{'uedit_mode'}) ? $o->{'uedit_mode'} : 0,
printf "<input type=radio name=uedit_mode value=1 %s> $text{'acl_uedit_none'}&nbsp;\n", [ [ 0, $text{'acl_uedit_all'} ],
$o->{'uedit_mode'} == 1 ? "checked" : ""; [ 1, $text{'acl_uedit_none'} ],
printf "<input type=radio name=uedit_mode value=6 %s> $text{'acl_uedit_this'}<br>\n", [ 6, $text{'acl_uedit_this'} ],
$o->{'uedit_mode'} == 6 ? "checked" : ""; [ 2, $text{'acl_uedit_only'},
printf "<input type=radio name=uedit_mode value=2 %s> $text{'acl_uedit_only'}\n", &ui_textbox("uedit_can",
$o->{'uedit_mode'} == 2 ? "checked" : ""; $o->{'uedit_mode'} == 2 ? $o->{'uedit'} : "", 40).
printf "<input name=uedit_can size=40 value='%s'> %s<br>\n", " ".&user_chooser_button("uedit_can", 1) ],
$o->{'uedit_mode'} == 2 ? $o->{'uedit'} : "", [ 3, $text{'acl_uedit_except'},
&user_chooser_button("uedit_can", 1); &ui_textbox("uedit_cannot",
printf "<input type=radio name=uedit_mode value=3 %s> $text{'acl_uedit_except'}\n", $o->{'uedit_mode'} == 3 ? $o->{'uedit'} : "", 40).
$o->{'uedit_mode'} == 3 ? "checked" : ""; " ".&user_chooser_button("uedit_cannot", 1) ],
printf "<input name=uedit_cannot size=40 value='%s'> %s<br>\n", [ 4, $text{'acl_uedit_uid'},
$o->{'uedit_mode'} == 3 ? $o->{'uedit'} : "", &ui_textbox("uedit_uid",
&user_chooser_button("uedit_cannot", 1); $o->{'uedit_mode'} == 4 ? $o->{'uedit'} : "", 6).
printf "<input type=radio name=uedit_mode value=4 %s> $text{'acl_uedit_uid'}\n", " - ".&ui_textbox("uedit_uid2",
$o->{'uedit_mode'} == 4 ? "checked" : ""; $o->{'uedit_mode'} == 4 ? $o->{'uedit2'} : "", 6) ],
printf "<input name=uedit_uid size=6 value='%s'> - \n", [ 5, $text{'acl_uedit_group'},
$o->{'uedit_mode'} == 4 ? $o->{'uedit'} : ""; &ui_textbox("uedit_group", $uedit_group, 40)." ".
printf "<input name=uedit_uid2 size=6 value='%s'><br>\n", &group_chooser_button("uedit_group", 1)."<br>\n".
$o->{'uedit_mode'} == 4 ? $o->{'uedit2'} : ""; &ui_checkbox("uedit_sec", 1, $text{'acl_uedit_sec'},
printf "<input type=radio name=uedit_mode value=5 %s> $text{'acl_uedit_group'}\n", $o->{'uedit_sec'}) ],
$o->{'uedit_mode'} == 5 ? "checked" : ""; [ 7, $text{'acl_uedit_re'},
printf "<input name=uedit_group size=40 value='%s'> %s<br>\n", &ui_textbox("uedit_re",
$o->{'uedit_mode'} == 5 ? $o->{'uedit_mode'} == 7 ? $o->{'uedit_re'} : "", 40) ] ], 1),
join(" ", map { "".getgrgid($_) } split(/\s+/, $o->{'uedit'})) :"", 3);
&group_chooser_button("uedit_group", 1);
printf "%s <input type=checkbox name=uedit_sec value=1 %s> %s<br>\n",
"&nbsp;" x 5, $o->{'uedit_sec'} ? 'checked' : '',$text{'acl_uedit_sec'};
printf "<input type=radio name=uedit_mode value=7 %s> $text{'acl_uedit_re'}\n",
$o->{'uedit_mode'} == 7 ? "checked" : "";
printf "<input name=uedit_re size=40 value='%s'> %s<br>\n",
$o->{'uedit_mode'} == 7 ? $o->{'uedit_re'} : "";
print "</td> </tr>\n";
print "<tr> <td><b>$text{'acl_ucreate'}</b></td> <td>\n"; print &ui_table_row($text{'acl_ucreate'},
printf "<input type=radio name=ucreate value=1 %s> $text{'yes'}\n", &ui_yesno_radio("ucreate", $o->{'ucreate'}));
$o->{'ucreate'} ? "checked" : ""; print &ui_table_row($text{'acl_batch'},
printf "<input type=radio name=ucreate value=0 %s> $text{'no'}</td>\n", &ui_yesno_radio("batch", $o->{'batch'}));
$o->{'ucreate'} ? "" : "checked";
print "<td><b>$text{'acl_batch'}</b></td> <td>\n"; print &ui_table_row($text{'acl_home'},
printf "<input type=radio name=batch value=1 %s> $text{'yes'}\n", &ui_textbox("home", $o->{'home'}, 40)." ".
$o->{'batch'} ? "checked" : ""; &file_chooser_button("home", 1)."<br>\n".
printf "<input type=radio name=batch value=0 %s> $text{'no'}</td> </tr>\n", &ui_checkbox("autohome", 1, $text{'acl_autohome'}, $o->{'autohome'}),
$o->{'batch'} ? "" : "checked"; 3);
print "<tr> <td valign=top><b>$text{'acl_home'}</b></td>\n"; print &ui_table_row($text{'acl_uid'},
printf "<td colspan=3><input name=home size=40 value='%s'> %s<br>\n", join("", map { &ui_checkbox($_, 1, $text{'acl_'.$_}, $o->{$_}) }
$o->{'home'}, &file_chooser_button("home", 1); ('umultiple', 'gmultiple')),
printf "<input type=checkbox name=autohome value=1 %s> %s</td> </tr>\n", 3);
$o->{'autohome'} ? "checked" : "",
$text{'acl_autohome'};
print "<tr> <td valign=top><b>$text{'acl_uid'}</b></td>\n"; print &ui_table_hr();
print "<td colspan=3>";
printf "<input type=checkbox name=umultiple value=1 %s> %s<br>\n",
$o->{'umultiple'} ? "checked" : "", $text{'acl_umultiple'};
printf "<input type=checkbox name=gmultiple value=1 %s> %s<br>\n",
$o->{'gmultiple'} ? "checked" : "", $text{'acl_gmultiple'};
print "</td> </tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n"; print &ui_table_row($text{'acl_gedit'},
&ui_radio_table("gedit_mode",
defined($o->{'gedit_mode'}) ? $o->{'gedit_mode'} : 0,
[ [ 0, $text{'acl_gedit_all'} ],
[ 1, $text{'acl_gedit_none'} ],
[ 2, $text{'acl_gedit_only'},
&ui_textbox("gedit_can",
$o->{'gedit_mode'} == 2 ? $o->{'gedit'} : "", 40).
" ".&group_chooser_button("gedit_can", 1) ],
[ 3, $text{'acl_gedit_except'},
&ui_textbox("gedit_cannot",
$o->{'gedit_mode'} == 3 ? $o->{'gedit'} : "", 40).
" ".&group_chooser_button("gedit_cannot", 1) ],
[ 4, $text{'acl_gedit_gid'},
&ui_textbox("gedit_gid",
$o->{'gedit_mode'} == 4 ? $o->{'gedit'} : "", 6).
" - ".&ui_textbox("gedit_gid2",
$o->{'gedit_mode'} == 4 ? $o->{'gedit2'} : "", 6) ] ], 1),
3);
print "<tr> <td valign=top><b>$text{'acl_gedit'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_gcreate'},
printf "<input type=radio name=gedit_mode value=0 %s> $text{'acl_gedit_all'}&nbsp;&nbsp;\n", &ui_radio("gcreate", defined($o->{'gcreate'}) ? $o->{'gcreate'} : 0,
$o->{'gedit_mode'} == 0 ? "checked" : ""; [ [ 1, $text{'yes'} ],
printf "<input type=radio name=gedit_mode value=1 %s> $text{'acl_gedit_none'}<br>\n", [ 2, $text{'acl_gnew'} ],
$o->{'gedit_mode'} == 1 ? "checked" : ""; [ 0, $text{'no'} ] ]),
printf "<input type=radio name=gedit_mode value=2 %s> $text{'acl_gedit_only'}\n", 3);
$o->{'gedit_mode'} == 2 ? "checked" : "";
printf "<input name=gedit_can size=40 value='%s'> %s<br>\n",
$o->{'gedit_mode'} == 2 ? $o->{'gedit'} : "",
&group_chooser_button("gedit_can", 1);
printf "<input type=radio name=gedit_mode value=3 %s> $text{'acl_gedit_except'}\n",
$o->{'gedit_mode'} == 3 ? "checked" : "";
printf "<input name=gedit_cannot size=40 value='%s'> %s<br>\n",
$o->{'gedit_mode'} == 3 ? $o->{'gedit'} : "",
&group_chooser_button("gedit_cannot", 1);
printf "<input type=radio name=gedit_mode value=4 %s> $text{'acl_gedit_gid'}\n",
$o->{'gedit_mode'} == 4 ? "checked" : "";
printf "<input name=gedit_gid size=6 value='%s'> -\n",
$o->{'gedit_mode'} == 4 ? $o->{'gedit'} : "";
printf "<input name=gedit_gid2 size=6 value='%s'></td> </tr>\n",
$o->{'gedit_mode'} == 4 ? $o->{'gedit2'} : "";
print "<tr> <td><b>$text{'acl_gcreate'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=gcreate value=1 %s> $text{'yes'}\n",
$o->{'gcreate'}==1 ? "checked" : "";
printf "<input type=radio name=gcreate value=2 %s> $text{'acl_gnew'}\n",
$o->{'gcreate'}==2 ? "checked" : "";
printf "<input type=radio name=gcreate value=0 %s> $text{'no'}</td> </tr>\n",
$o->{'gcreate'}==0 ? "checked" : "";
} }
# acl_security_save(&options) # acl_security_save(&options)
+43 -78
View File
@@ -5,90 +5,55 @@ require 'lpadmin-lib.pl';
# Output HTML for editing security options for the lpadmin module # Output HTML for editing security options for the lpadmin module
sub acl_security_form sub acl_security_form
{ {
print "<tr> <td valign=top><b>$text{'acl_printers'}</b></td>\n"; my ($o) = @_;
print "<td colspan=3>\n"; my @plist = &list_printers();
printf "<input name=printers_def type=radio value=1 %s> %s\n", my @popts = map {
$_[0]->{'printers'} eq '*' ? 'checked' : '', $text{'acl_pall'}; my $prn = &get_printer($_);
printf "<input name=printers_def type=radio value=0 %s> %s<br>\n", [ $_, $prn->{'desc'}." ($_)" ]
$_[0]->{'printers'} eq '*' ? '' : 'checked', $text{'acl_psel'}; } @plist;
print "<select name=printers multiple size=4 width=15>\n";
local @plist = &list_printers();
local ($p, %pcan);
map { $pcan{$_}++ } split(/\s+/, $_[0]->{'printers'});
foreach $p (@plist) {
local $prn = &get_printer($p);
printf "<option value=%s %s>%s (%s)</option>\n",
$p, $pcan{$p} ? 'selected' : '',
$prn->{'desc'}, $p;
}
print "</select></td> </tr>\n";
print "<tr> <td valign=top><b>$text{'acl_cancel'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_printers'},
printf "<input type=radio name=cancel value=0 %s> $text{'no'}\n", &ui_radio("printers_def", $o->{'printers'} eq '*' ? 1 : 0,
$_[0]->{'cancel'} == 0 ? "checked" : ""; [ [ 1, $text{'acl_pall'} ],
printf "<input type=radio name=cancel value=1 %s> $text{'yes'}\n", [ 0, $text{'acl_psel'} ] ])."<br>\n".
$_[0]->{'cancel'} == 1 ? "checked" : ""; &ui_select("printers", [ split(/\s+/, $o->{'printers'}) ], \@popts, 4, 1),
printf "<input type=radio name=cancel value=2 %s> $text{'acl_listed'}<br>\n", 3);
$_[0]->{'cancel'} == 2 ? "checked" : "";
print "<select name=jobs multiple size=4 width=15>\n";
map { $jcan{$_}++ } split(/\s+/, $_[0]->{'jobs'});
foreach $p (@plist) {
local $prn = &get_printer($p);
printf "<option value=%s %s>%s (%s)</option>\n",
$p, $jcan{$p} ? 'selected' : '',
$prn->{'desc'}, $p;
}
print "</select></td> </tr>\n";
print "<tr> <td><b>$text{'acl_user'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_cancel'},
printf "<input type=radio name=user_def value=1 %s> %s\n", &ui_radio_table("cancel",
$_[0]->{'user'} eq '*' ? 'checked' : '', $text{'acl_user_all'}; defined($o->{'cancel'}) ? $o->{'cancel'} : 0,
printf "<input type=radio name=user_def value=2 %s> %s\n", [ [ 0, $text{'no'} ],
$_[0]->{'user'} ? '' : 'checked', $text{'acl_user_this'}; [ 1, $text{'yes'} ],
printf "<input type=radio name=user_def value=0 %s>\n", [ 2, $text{'acl_listed'},
$_[0]->{'user'} eq '*' || !$_[0]->{'user'} ? '' : 'checked'; &ui_select("jobs", [ split(/\s+/, $o->{'jobs'}) ], \@popts, 4, 1) ] ], 1),
printf "<input name=user size=13 value='%s'></td> </tr>\n", 3);
$_[0]->{'user'} eq '*' || !$_[0]->{'user'} ? '' : $_[0]->{'user'};
print "<tr> <td><b>$text{'acl_add'}</b></td>\n"; my $user_def = $o->{'user'} eq '*' ? 1 : $o->{'user'} ? 0 : 2;
printf "<td><input type=radio name=add value=1 %s> $text{'yes'}\n", print &ui_table_row($text{'acl_user'},
$_[0]->{'add'} ? "checked" : ""; &ui_radio_table("user_def", $user_def,
printf "<input type=radio name=add value=0 %s> $text{'no'}</td>\n", [ [ 1, $text{'acl_user_all'} ],
$_[0]->{'add'} ? "" : "checked"; [ 2, $text{'acl_user_this'} ],
[ 0, "", &ui_textbox("user",
$user_def == 0 ? $o->{'user'} : "", 13) ] ], 1),
3);
print "<td><b>$text{'acl_stop'}</b></td>\n"; print &ui_table_row($text{'acl_add'},
printf "<td><input type=radio name=stop value=1 %s> $text{'yes'}\n", &ui_yesno_radio("add", $o->{'add'}));
$_[0]->{'stop'} == 1 ? "checked" : ""; print &ui_table_row($text{'acl_stop'},
printf "<input type=radio name=stop value=2 %s> $text{'acl_restart'}\n", &ui_radio("stop", defined($o->{'stop'}) ? $o->{'stop'} : 0,
$_[0]->{'stop'} == 2 ? "checked" : ""; [ [ 1, $text{'yes'} ],
printf "<input type=radio name=stop value=0 %s> $text{'no'}</td> </tr>\n", [ 2, $text{'acl_restart'} ],
$_[0]->{'stop'} == 0 ? "checked" : ""; [ 0, $text{'no'} ] ]));
print "<tr> <td><b>$text{'acl_view'}</b></td>\n"; print &ui_table_row($text{'acl_view'},
printf "<td><input type=radio name=view value=1 %s> $text{'yes'}\n", &ui_yesno_radio("view", $o->{'view'}));
$_[0]->{'view'} ? "checked" : ""; print &ui_table_row($text{'acl_test'},
printf "<input type=radio name=view value=0 %s> $text{'no'}</td>\n", &ui_yesno_radio("test", $o->{'test'}));
$_[0]->{'view'} ? "" : "checked";
print "<td><b>$text{'acl_test'}</b></td>\n"; print &ui_table_row($text{'acl_delete'},
printf "<td><input type=radio name=test value=1 %s> $text{'yes'}\n", &ui_yesno_radio("delete", $o->{'delete'}));
$_[0]->{'test'} ? "checked" : ""; print &ui_table_row($text{'acl_cluster'},
printf "<input type=radio name=test value=0 %s> $text{'no'}</td> </tr>\n", &ui_yesno_radio("cluster", $o->{'cluster'}));
$_[0]->{'test'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_delete'}</b></td>\n";
printf "<td><input type=radio name=delete value=1 %s> $text{'yes'}\n",
$_[0]->{'delete'} ? "checked" : "";
printf "<input type=radio name=delete value=0 %s> $text{'no'}</td>\n",
$_[0]->{'delete'} ? "" : "checked";
print "<td><b>$text{'acl_cluster'}</b></td>\n";
printf "<td><input type=radio name=cluster value=1 %s> $text{'yes'}\n",
$_[0]->{'cluster'} ? "checked" : "";
printf "<input type=radio name=cluster value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'cluster'} ? "" : "checked";
print "</tr>\n";
} }
# acl_security_save(&options) # acl_security_save(&options)
+49 -71
View File
@@ -5,85 +5,63 @@ require 'mysql-lib.pl';
# Output HTML for editing security options for the mysql module # Output HTML for editing security options for the mysql module
sub acl_security_form sub acl_security_form
{ {
print "<tr> <td valign=top rowspan=3><b>$text{'acl_dbs'}</b></td>\n"; my ($o) = @_;
print "<td rowspan=3 valign=top>\n"; my @dbs = &list_databases();
printf "<input type=radio name=dbs_def value=1 %s> %s\n",
$_[0]->{'dbs'} eq '*' ? 'checked' : '', $text{'acl_dall'};
printf "<input type=radio name=dbs_def value=0 %s> %s<br>\n",
$_[0]->{'dbs'} eq '*' ? '' : 'checked', $text{'acl_dsel'};
print "<select name=dbs size=3 multiple width=100>\n";
map { $dcan{$_}++ } split(/\s+/, $_[0]->{'dbs'});
foreach $d (&list_databases()) {
printf "<option %s>%s</option>\n",
$dcan{$d} ? 'selected' : '', $d;
}
print "</select></td>\n";
print "<td><b>$text{'acl_delete'}</b></td> <td>\n"; print &ui_table_row($text{'acl_dbs'},
printf "<input type=radio name=delete value=1 %s> %s\n", &ui_radio("dbs_def", $o->{'dbs'} eq '*' ? 1 : 0,
$_[0]->{'delete'} ? 'checked' : '', $text{'yes'}; [ [ 1, $text{'acl_dall'} ],
printf "<input type=radio name=delete value=0 %s> %s</td> </tr>\n", [ 0, $text{'acl_dsel'} ] ])."<br>\n".
$_[0]->{'delete'} ? '' : 'checked', $text{'no'}; &ui_select("dbs", [ split(/\s+/, $o->{'dbs'}) ], \@dbs, 3, 1),
3);
print "<tr> <td><b>$text{'acl_stop'}</b></td> <td>\n"; print &ui_table_row($text{'acl_delete'},
printf "<input type=radio name=stop value=1 %s> %s\n", &ui_yesno_radio("delete", $o->{'delete'}));
$_[0]->{'stop'} ? 'checked' : '', $text{'yes'}; print &ui_table_row($text{'acl_stop'},
printf "<input type=radio name=stop value=0 %s> %s</td> </tr>\n", &ui_yesno_radio("stop", $o->{'stop'}));
$_[0]->{'stop'} ? '' : 'checked', $text{'no'}; print &ui_table_row($text{'acl_edonly'},
&ui_yesno_radio("edonly", $o->{'edonly'}));
print "<tr> <td><b>$text{'acl_edonly'}</b></td> <td>\n"; print &ui_table_row($text{'acl_indexes'},
printf "<input type=radio name=edonly value=1 %s> %s\n", &ui_yesno_radio("indexes", $o->{'indexes'}));
$_[0]->{'edonly'} ? 'checked' : '', $text{'yes'}; print &ui_table_row($text{'acl_views'},
printf "<input type=radio name=edonly value=0 %s> %s</td> </tr>\n", &ui_yesno_radio("views", $o->{'views'}));
$_[0]->{'edonly'} ? '' : 'checked', $text{'no'};
print "<tr> <td><b>$text{'acl_indexes'}</b></td>\n"; print &ui_table_row($text{'acl_create'},
print "<td>",&ui_yesno_radio("indexes", $_[0]->{'indexes'}),"</td>\n"; &ui_radio_table("create",
defined($o->{'create'}) ? $o->{'create'} : 0,
[ [ 1, $text{'yes'} ],
[ 2, $text{'acl_max'},
&ui_textbox("max", $o->{'max'}, 5) ],
[ 0, $text{'no'} ] ], 1),
3);
print "<td><b>$text{'acl_views'}</b></td>\n"; print &ui_table_row($text{'acl_perms'},
print "<td>",&ui_yesno_radio("views", $_[0]->{'views'}),"</td> </tr>\n"; &ui_radio("perms", defined($o->{'perms'}) ? $o->{'perms'} : 0,
[ [ 1, $text{'yes'} ],
[ 2, $text{'acl_only'} ],
[ 0, $text{'no'} ] ]),
3);
print "<tr> <td><b>$text{'acl_create'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_login'},
printf "<input type=radio name=create value=1 %s> %s\n", &ui_radio_table("user_def", $o->{'user'} ? 0 : 1,
$_[0]->{'create'} == 1 ? 'checked' : '', $text{'yes'}; [ [ 1, $text{'acl_user_def'} ],
printf "<input type=radio name=create value=2 %s> %s\n", [ 0, "",
$_[0]->{'create'} == 2 ? 'checked' : '', $text{'acl_max'}; $text{'acl_user'}." ".
printf "<input name=max size=5 value='%s'>\n", &ui_textbox("user", $o->{'user'}, 10)." ".
$_[0]->{'max'}; $text{'acl_pass'}." ".
printf "<input type=radio name=create value=0 %s> %s</td> </tr>\n", &ui_password("pass", $o->{'pass'}, 10) ] ], 1),
$_[0]->{'create'} == 0 ? 'checked' : '', $text{'no'}; 3);
print "<tr> <td><b>$text{'acl_perms'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_buser'},
printf "<input name=perms type=radio value=1 %s> %s\n", &ui_opt_textbox("buser", $o->{'buser'}, 8, $text{'acl_bnone'})." ".
$_[0]->{'perms'} == 1 ? 'checked' : '', $text{'yes'}; &user_chooser_button("buser"),
printf "<input name=perms type=radio value=2 %s> %s\n", 3);
$_[0]->{'perms'} == 2 ? 'checked' : '', $text{'acl_only'};
printf "<input name=perms type=radio value=0 %s> %s\n",
$_[0]->{'perms'} == 0 ? 'checked' : '', $text{'no'};
print "</td> </tr>\n";
print "<tr> <td valign=top><b>$text{'acl_login'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=user_def value=1 %s> %s<br>\n",
$_[0]->{'user'} ? '' : 'checked', $text{'acl_user_def'};
printf "<input type=radio name=user_def value=0 %s>\n",
$_[0]->{'user'} ? 'checked' : '';
printf "%s <input name=user size=10 value='%s'>\n",
$text{'acl_user'}, $_[0]->{'user'};
printf "%s <input name=pass type=password size=10 value='%s'></td> </tr>\n",
$text{'acl_pass'}, $_[0]->{'pass'};
print "<tr> <td><b>$text{'acl_buser'}</b></td>\n";
printf "<td colspan=3><input type=radio name=buser_def value=1 %s> %s\n",
$_[0]->{'buser'} ? "" : "checked", $text{'acl_bnone'};
printf "<input type=radio name=buser_def value=0 %s>\n",
$_[0]->{'buser'} ? "checked" : "";
printf "<input name=buser size=8 value='%s'> %s</td> </tr>\n",
$_[0]->{'buser'}, &user_chooser_button("buser");
print "<tr> <td><b>$text{'acl_bpath'}</b></td>\n";
printf "<td colspan=3><input name=bpath size=40 value='%s'> %s</td> </tr>\n",
$_[0]->{'bpath'}, &file_chooser_button("bpath", 1);
print &ui_table_row($text{'acl_bpath'},
&ui_textbox("bpath", $o->{'bpath'}, 40)." ".
&file_chooser_button("bpath", 1),
3);
} }
# acl_security_save(&options) # acl_security_save(&options)
+48 -94
View File
@@ -5,108 +5,62 @@ require 'postgresql-lib.pl';
# Output HTML for editing security options for the postgresql module # Output HTML for editing security options for the postgresql module
sub acl_security_form sub acl_security_form
{ {
my (@listdb)=&list_databases(); my ($o) = @_;
print "<tr> <td valign=top rowspan=4><b>$text{'acl_dbs'}</b>\n"; my @listdb = &list_databases();
print "<br>$text{'acl_dbscannot'}" unless @listdb;
print "</td>\n";
print "<td rowspan=4 valign=top>\n";
if (@listdb) { if (@listdb) {
printf "<input type=radio name=dbs_def value=1 %s> %s\n", print &ui_table_row($text{'acl_dbs'},
$_[0]->{'dbs'} eq '*' ? 'checked' : '', $text{'acl_dall'}; &ui_radio("dbs_def", $o->{'dbs'} eq '*' ? 1 : 0,
printf "<input type=radio name=dbs_def value=0 %s> %s<br>\n", [ [ 1, $text{'acl_dall'} ],
$_[0]->{'dbs'} eq '*' ? '' : 'checked', $text{'acl_dsel'}; [ 0, $text{'acl_dsel'} ] ])."<br>\n".
print "<select name=dbs size=5 multiple width=100>\n"; &ui_select("dbs", [ split(/\s+/, $o->{'dbs'}) ], \@listdb, 5, 1).
map { $dcan{$_}++ } split(/\s+/, $_[0]->{'dbs'}); &ui_hidden("dblist", "1"),
foreach $d (@listdb) { 3);
printf "<option %s>%s</option>\n", }
$dcan{$d} ? 'selected' : '', $d; else {
} print &ui_table_row($text{'acl_dbs'},
print "</select>"; $text{'acl_dbscannot'}.&ui_hidden("dblist", "0 ".$o->{'dbs'}),
print "<input type=hidden name=dblist value=\"1\">\n"; 3);
}
else {
print "<input type=hidden name=dblist value=\"0 ".$_[0]->{'dbs'}."\">\n";
} }
print "</td>\n";
print "<td><b>$text{'acl_create'}</b></td> <td>\n"; print &ui_table_row($text{'acl_create'},
printf "<input type=radio name=create value=1 %s> %s\n", &ui_radio_table("create",
$_[0]->{'create'} == 1 ? 'checked' : '', $text{'yes'}; defined($o->{'create'}) ? $o->{'create'} : 0,
printf "<input type=radio name=create value=2 %s> %s\n", [ [ 1, $text{'yes'} ],
$_[0]->{'create'} == 2 ? 'checked' : '', $text{'acl_max'}; [ 2, $text{'acl_max'}, &ui_textbox("max", $o->{'max'}, 5) ],
printf "<input name=max size=5 value='%s'>\n", [ 0, $text{'no'} ] ], 1),
$_[0]->{'max'}; 3);
printf "<input type=radio name=create value=0 %s> %s</td> </tr>\n",
$_[0]->{'create'} == 0 ? 'checked' : '', $text{'no'};
print "<tr> <td><b>$text{'acl_delete'}</b></td> <td>\n"; print &ui_table_row($text{'acl_delete'},
printf "<input type=radio name=delete value=1 %s> %s\n", &ui_yesno_radio("delete", $o->{'delete'}));
$_[0]->{'delete'} ? 'checked' : '', $text{'yes'}; print &ui_table_row($text{'acl_stop'},
printf "<input type=radio name=delete value=0 %s> %s</td> </tr>\n", &ui_yesno_radio("stop", $o->{'stop'}));
$_[0]->{'delete'} ? '' : 'checked', $text{'no'}; print &ui_table_row($text{'acl_users'},
&ui_yesno_radio("users", $o->{'users'}));
print "<tr> <td><b>$text{'acl_stop'}</b></td> <td>\n"; print &ui_table_row($text{'acl_login'},
printf "<input type=radio name=stop value=1 %s> %s\n", &ui_radio_table("user_def", $o->{'user'} ? 0 : 1,
$_[0]->{'stop'} ? 'checked' : '', $text{'yes'}; [ [ 1, $text{'acl_user_def'} ],
printf "<input type=radio name=stop value=0 %s> %s</td> </tr>\n", [ 0, "",
$_[0]->{'stop'} ? '' : 'checked', $text{'no'}; $text{'acl_user'}." ".&ui_textbox("user", $o->{'user'}, 10)." ".
$text{'acl_pass'}." ".&ui_password("pass", $o->{'pass'}, 10)."<br>\n".
&ui_checkbox("sameunix", 1, $text{'acl_sameunix'}, $o->{'sameunix'}) ] ], 1),
3);
print "<tr> <td><b>$text{'acl_users'}</b></td> <td>\n"; print &ui_table_row($text{'acl_backup'},
printf "<input type=radio name=users value=1 %s> %s\n", &ui_yesno_radio("backup", $o->{'backup'}));
$_[0]->{'users'} ? 'checked' : '', $text{'yes'}; print &ui_table_row($text{'acl_restore'},
printf "<input type=radio name=users value=0 %s> %s</td> </tr>\n", &ui_yesno_radio("restore", $o->{'restore'}));
$_[0]->{'users'} ? '' : 'checked', $text{'no'};
print "<tr> <td valign=top><b>$text{'acl_login'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_cmds'},
printf "<input type=radio name=user_def value=1 %s> %s<br>\n", &ui_yesno_radio("cmds", $o->{'cmds'}));
$_[0]->{'user'} ? '' : 'checked', $text{'acl_user_def'}; print &ui_table_row($text{'acl_views'},
printf "<input type=radio name=user_def value=0 %s>\n", &ui_yesno_radio("views", $o->{'views'}));
$_[0]->{'user'} ? 'checked' : '';
printf "%s <input name=user size=10 value='%s'>\n",
$text{'acl_user'}, $_[0]->{'user'};
printf "%s <input name=pass type=password size=10 value='%s'><br>\n",
$text{'acl_pass'}, $_[0]->{'pass'};
print "&nbsp;&nbsp;&nbsp;\n";
printf "<input type=checkbox name=sameunix value=1 %s> %s</td> </tr>\n",
$_[0]->{'sameunix'} ? "checked" : "", $text{'acl_sameunix'};
print "<tr> <td><b>$text{'acl_backup'}</b></td> <td>\n"; print &ui_table_row($text{'acl_indexes'},
printf "<input type=radio name=backup value=1 %s> %s\n", &ui_yesno_radio("indexes", $o->{'indexes'}));
$_[0]->{'backup'} ? 'checked' : '', $text{'yes'}; print &ui_table_row($text{'acl_seqs'},
printf "<input type=radio name=backup value=0 %s> %s</td>\n", &ui_yesno_radio("seqs", $o->{'seqs'}));
$_[0]->{'backup'} ? '' : 'checked', $text{'no'};
print "<td><b>$text{'acl_restore'}</b></td> <td>\n";
printf "<input type=radio name=restore value=1 %s> %s\n",
$_[0]->{'restore'} ? 'checked' : '', $text{'yes'};
printf "<input type=radio name=restore value=0 %s> %s</td> </tr>\n",
$_[0]->{'restore'} ? '' : 'checked', $text{'no'};
print "<tr> <td valign=top><b>$text{'acl_cmds'}</b></td> <td>\n";
printf "<input type=radio name=cmds value=1 %s> %s\n",
$_[0]->{'cmds'} ? "checked" : "", $text{'yes'};
printf "<input type=radio name=cmds value=0 %s> %s</td>\n",
$_[0]->{'cmds'} ? "" : "checked", $text{'no'};
print "<td><b>$text{'acl_views'}</b></td> <td>\n";
printf "<input type=radio name=views value=1 %s> %s\n",
$_[0]->{'views'} ? 'checked' : '', $text{'yes'};
printf "<input type=radio name=views value=0 %s> %s</td> </tr>\n",
$_[0]->{'views'} ? '' : 'checked', $text{'no'};
print "<tr> <td valign=top><b>$text{'acl_indexes'}</b></td> <td>\n";
printf "<input type=radio name=indexes value=1 %s> %s\n",
$_[0]->{'indexes'} ? "checked" : "", $text{'yes'};
printf "<input type=radio name=indexes value=0 %s> %s</td>\n",
$_[0]->{'indexes'} ? "" : "checked", $text{'no'};
print "<td><b>$text{'acl_seqs'}</b></td> <td>\n";
printf "<input type=radio name=seqs value=1 %s> %s\n",
$_[0]->{'seqs'} ? 'checked' : '', $text{'yes'};
printf "<input type=radio name=seqs value=0 %s> %s</td> </tr>\n",
$_[0]->{'seqs'} ? '' : 'checked', $text{'no'};
print "</tr>\n";
} }
# acl_security_save(&options) # acl_security_save(&options)
+98 -256
View File
@@ -5,222 +5,83 @@ require 'samba-lib.pl';
# Output HTML for editing security options for the samba module # Output HTML for editing security options for the samba module
sub acl_security_form sub acl_security_form
{ {
print "<tr>\n<td><b>$text{'acl_apply'}</b></td> <td>\n"; my ($o) = @_;
printf "<input type=radio name=apply value=1 %s> $text{'yes'}\n",
$_[0]->{'apply'} ? "checked" : "";
printf "<input type=radio name=apply value=0 %s> $text{'no'}</td>\n",
$_[0]->{'apply'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_view_all_con'}</b></td> <td>\n"; foreach my $f ('apply', 'view_all_con', 'kill_con') {
printf "<input type=radio name=view_all_con value=1 %s> $text{'yes'}\n", print &ui_table_row($text{'acl_'.$f},
$_[0]->{'view_all_con'} ? "checked" : ""; &ui_yesno_radio($f, $o->{$f}));
printf "<input type=radio name=view_all_con value=0 %s> $text{'no'}</td>\n",
$_[0]->{'view_all_con'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_kill_con'}</b></td> <td>\n";
printf "<input type=radio name=kill_con value=1 %s> $text{'yes'}\n",
$_[0]->{'kill_con'} ? "checked" : "";
printf "<input type=radio name=kill_con value=0 %s> $text{'no'}</td>\n",
$_[0]->{'kill_con'} ? "" : "checked";
print "</tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n";
print "<tr>\n<td><b>$text{'acl_conf_net'}</b></td> <td>\n";
printf "<input type=radio name=conf_net value=1 %s> $text{'yes'}\n",
$_[0]->{'conf_net'} ? "checked" : "";
printf "<input type=radio name=conf_net value=0 %s> $text{'no'}</td>\n",
$_[0]->{'conf_net'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_conf_smb'}</b></td> <td>\n";
printf "<input type=radio name=conf_smb value=1 %s> $text{'yes'}\n",
$_[0]->{'conf_smb'} ? "checked" : "";
printf "<input type=radio name=conf_smb value=0 %s> $text{'no'}</td>\n",
$_[0]->{'conf_smb'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_conf_pass'}</b></td> <td>\n";
printf "<input type=radio name=conf_pass value=1 %s> $text{'yes'}\n",
$_[0]->{'conf_pass'} ? "checked" : "";
printf "<input type=radio name=conf_pass value=0 %s> $text{'no'}</td>\n",
$_[0]->{'conf_pass'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_conf_print'}</b></td> <td>\n";
printf "<input type=radio name=conf_print value=1 %s> $text{'yes'}\n",
$_[0]->{'conf_print'} ? "checked" : "";
printf "<input type=radio name=conf_print value=0 %s> $text{'no'}</td>\n",
$_[0]->{'conf_print'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_conf_misc'}</b></td> <td>\n";
printf "<input type=radio name=conf_misc value=1 %s> $text{'yes'}\n",
$_[0]->{'conf_misc'} ? "checked" : "";
printf "<input type=radio name=conf_misc value=0 %s> $text{'no'}</td>\n",
$_[0]->{'conf_misc'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_swat'}</b></td> <td>\n";
printf "<input type=radio name=swat value=1 %s> $text{'yes'}\n",
$_[0]->{'swat'} ? "checked" : "";
printf "<input type=radio name=swat value=0 %s> $text{'no'}</td>\n",
$_[0]->{'swat'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_manual'}</b></td> <td>\n";
printf "<input type=radio name=manual value=1 %s> $text{'yes'}\n",
$_[0]->{'manual'} ? "checked" : "";
printf "<input type=radio name=manual value=0 %s> $text{'no'}</td>\n",
$_[0]->{'manual'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_winbind'}</b></td> <td>\n";
printf "<input type=radio name=winbind value=1 %s> $text{'yes'}\n",
$_[0]->{'winbind'} ? "checked" : "";
printf "<input type=radio name=winbind value=0 %s> $text{'no'}</td>\n",
$_[0]->{'winbind'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_bind'}</b></td> <td>\n";
printf "<input type=radio name=conf_bind value=1 %s> $text{'yes'}\n",
$_[0]->{'conf_bind'} ? "checked" : "";
printf "<input type=radio name=conf_bind value=0 %s> $text{'no'}</td>\n",
$_[0]->{'conf_bind'} ? "" : "checked";
print "</tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n";
# encripted passwords
print "<tr>\n<td $tb><b>$text{'acl_enc_passwd_opts'}</b></td></tr> \n";
print "<tr>\n<td><b>$text{'acl_view_users'}</b></td> <td>\n";
printf "<input type=radio name=view_users value=1 %s> $text{'yes'}\n",
$_[0]->{'view_users'} ? "checked" : "";
printf "<input type=radio name=view_users value=0 %s> $text{'no'}</td>\n",
$_[0]->{'view_users'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_maint_users'}</b></td> <td>\n";
printf "<input type=radio name=maint_users value=1 %s> $text{'yes'}\n",
$_[0]->{'maint_users'} ? "checked" : "";
printf "<input type=radio name=maint_users value=0 %s> $text{'no'}</td>\n",
$_[0]->{'maint_users'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_maint_makepass'}</b></td> <td>\n";
printf "<input type=radio name=maint_makepass value=1 %s> $text{'yes'}\n",
$_[0]->{'maint_makepass'} ? "checked" : "";
printf "<input type=radio name=maint_makepass value=0 %s> $text{'no'}</td>\n",
$_[0]->{'maint_makepass'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_maint_sync'}</b></td> <td>\n";
printf "<input type=radio name=maint_sync value=1 %s> $text{'yes'}\n",
$_[0]->{'maint_sync'} ? "checked" : "";
printf "<input type=radio name=maint_sync value=0 %s> $text{'no'}</td>\n",
$_[0]->{'maint_sync'} ? "" : "checked";
print "</tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n";
# encripted passwords
print "<tr>\n<td $tb><b>$text{'acl_group_opts'}</b></td></tr> \n";
print "<tr>\n<td><b>$text{'acl_maint_groups'}</b></td> <td>\n";
printf "<input type=radio name=maint_groups value=1 %s> $text{'yes'}\n",
$_[0]->{'maint_groups'} ? "checked" : "";
printf "<input type=radio name=maint_groups value=0 %s> $text{'no'}</td>\n",
$_[0]->{'maint_groups'} ? "" : "checked";
print "</tr>\n";
print "<tr>\n<td><b>$text{'acl_maint_gsync'}</b></td> <td>\n";
printf "<input type=radio name=maint_gsync value=1 %s> $text{'yes'}\n",
$_[0]->{'maint_gsync'} ? "checked" : "";
printf "<input type=radio name=maint_gsync value=0 %s> $text{'no'}</td>\n",
$_[0]->{'maint_gsync'} ? "" : "checked";
print "</tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n";
# hide
print "<tr>\n<td><b>$text{'acl_hide'}</b></td> <td>\n";
printf "<input type=radio name=hide value=1 %s> $text{'yes'}\n",
$_[0]->{'hide'} == 1 ? "checked" : "";
printf "<input type=radio name=hide value=0 %s> $text{'no'}</td>\n",
$_[0]->{'hide'} == 0 ? "checked" : "";
print "</tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n";
# global acls
print "<tr>\n<td><b>$text{'acl_afs'}</b></td>\n";
print "<td colspan=3>\n";
printf "<input type=checkbox name=c_fs value=1 %s> %s\n",
$_[0]->{'c_fs'} ? "checked" : "", $text{"acl_c"};
printf "<input type=checkbox name=r_fs value=1 %s> %s\n",
$_[0]->{'r_fs'} ? "checked" : "", $text{"acl_r"};
printf "<input type=checkbox name=w_fs value=1 %s> %s\n",
$_[0]->{'w_fs'} ? "checked" : "", $text{"acl_w"};
print "</td> </tr>\n";
print "<tr>\n<td><b>$text{'acl_aps'}</b></td>\n";
print "<td colspan=3>\n";
printf "<input type=checkbox name=c_ps value=1 %s> %s\n",
$_[0]->{'c_ps'} ? "checked" : "", $text{"acl_c"};
printf "<input type=checkbox name=r_ps value=1 %s> %s\n",
$_[0]->{'r_ps'} ? "checked" : "", $text{"acl_r"};
printf "<input type=checkbox name=w_ps value=1 %s> %s\n",
$_[0]->{'w_ps'} ? "checked" : "", $text{"acl_w"};
print "</td> </tr>\n";
print "<tr>\n<td><b>$text{'acl_copy'}</b></td> <td>\n";
printf "<input type=radio name=copy value=1 %s> $text{'yes'}\n",
$_[0]->{'copy'} ? "checked" : "";
printf "<input type=radio name=copy value=0 %s> $text{'no'}</td>\n",
$_[0]->{'copy'} ? "" : "checked";
print "</tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n";
# per-share acls
print "<tr><td><b>$text{'acl_per_fs_acls'}</b></td> <td>\n";
printf "<input type=radio name=per_fs_acls value=1 %s> $text{'yes'}\n",
$_[0]->{'per_fs_acls'} ? "checked" : "";
printf "<input type=radio name=per_fs_acls value=0 %s> $text{'no'}\n",
$_[0]->{'per_fs_acls'} ? "" : "checked";
print "</td></tr>\n";
print "<tr><td><b>$text{'acl_per_ps_acls'}</b></td> <td>\n";
printf "<input type=radio name=per_ps_acls value=1 %s> $text{'yes'}\n",
$_[0]->{'per_ps_acls'} ? "checked" : "";
printf "<input type=radio name=per_ps_acls value=0 %s> $text{'no'}\n",
$_[0]->{'per_ps_acls'} ? "" : "checked";
print "</td></tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n";
# table
print "<tr> <td colspan=4>\n<table border width=100%>\n";
printf "<th $tb colspan=7><b>%s</b></th>\n", $text{'acl_per_share_acls'};
print "<tr $tb>\n";
printf "<td rowspan=2><b>%s</b></td>\n", $text{'acl_sname'};
printf "<td rowspan=2><b>%s</b></td>\n", $text{'acl_saccess'};
printf "<td rowspan=2><b>%s</b></td>\n", $text{'acl_sconn'};
printf "<th colspan=4><b>%s</b></th>\n", $text{'acl_sopthdr'};
print "</tr>\n<tr $tb>\n";
printf "<td><b>%s</b></td>\n", $text{'acl_ssec'};
printf "<td><b>%s</b></td>\n", $text{'acl_sperm'};
printf "<td><b>%s</b></td>\n", $text{'acl_snaming'};
printf "<td><b>%s<br>%s</b></td>\n", $text{'acl_smisc'}, $text{'acl_sprn'};
print "</tr>\n";
foreach (&list_shares()) {
&display_acl_row($_[0], $_);
} }
print "</table> </td> </tr>\n";
print &ui_table_hr();
foreach my $f ('conf_net', 'conf_smb', 'conf_pass', 'conf_print',
'conf_misc', 'swat', 'manual', 'winbind') {
print &ui_table_row($text{'acl_'.$f},
&ui_yesno_radio($f, $o->{$f}));
}
print &ui_table_row($text{'acl_bind'},
&ui_yesno_radio("conf_bind", $o->{'conf_bind'}));
print &ui_table_hr();
print &ui_table_span($text{'acl_enc_passwd_opts'});
foreach my $f ('view_users', 'maint_users', 'maint_makepass', 'maint_sync') {
print &ui_table_row($text{'acl_'.$f},
&ui_yesno_radio($f, $o->{$f}));
}
print &ui_table_hr();
print &ui_table_span($text{'acl_group_opts'});
foreach my $f ('maint_groups', 'maint_gsync') {
print &ui_table_row($text{'acl_'.$f},
&ui_yesno_radio($f, $o->{$f}));
}
print &ui_table_hr();
print &ui_table_row($text{'acl_hide'},
&ui_yesno_radio("hide", defined($o->{'hide'}) ? $o->{'hide'} : 0));
print &ui_table_hr();
print &ui_table_row($text{'acl_afs'},
join("", map { &ui_checkbox($_."_fs", 1, $text{"acl_".$_}, $o->{$_."_fs"}) }
qw(c r w)),
3);
print &ui_table_row($text{'acl_aps'},
join("", map { &ui_checkbox($_."_ps", 1, $text{"acl_".$_}, $o->{$_."_ps"}) }
qw(c r w)),
3);
print &ui_table_row($text{'acl_copy'},
&ui_yesno_radio("copy", $o->{'copy'}));
print &ui_table_hr();
print &ui_table_row($text{'acl_per_fs_acls'},
&ui_yesno_radio("per_fs_acls", $o->{'per_fs_acls'}));
print &ui_table_row($text{'acl_per_ps_acls'},
&ui_yesno_radio("per_ps_acls", $o->{'per_ps_acls'}));
print &ui_table_hr();
my @heads = (
$text{'acl_sname'},
$text{'acl_saccess'},
$text{'acl_sconn'},
$text{'acl_ssec'},
$text{'acl_sperm'},
$text{'acl_snaming'},
$text{'acl_smisc'}." / ".$text{'acl_sprn'},
);
my $stable = &ui_columns_start(\@heads, 100);
foreach (&list_shares()) {
$stable .= &display_acl_row($o, $_);
}
$stable .= &ui_columns_end();
print &ui_table_row($text{'acl_per_share_acls'}, $stable, 3);
} }
# acl_security_save(&options) # acl_security_save(&options)
@@ -285,25 +146,23 @@ local %share;
local $stype=&istrue('printable') ? 'ps' : 'fs'; local $stype=&istrue('printable') ? 'ps' : 'fs';
local $aclname='ACL' . $stype . '_' . $name; local $aclname='ACL' . $stype . '_' . $name;
#display row return &ui_columns_row([
print "<tr>\n"; $stype eq 'fs' ? "<b>$name</b>" : "<i>$name</i>",
printf $stype eq 'fs' ? "<td><b>%s</b></td>\n" : &display_acl_cell($acc, $name, 'r', 'w', $aclname,
"<td><b><i>%s</i></td>\n", $name; $text{'acl_na'}, $text{'acl_r1'}, $text{'acl_rw'}),
&display_acl_cell($acc, $name, 'r', 'w', $aclname, &display_acl_cell($acc, $name, 'v', 'V', $aclname,
$text{'acl_na'}, $text{'acl_r1'}, $text{'acl_rw'}); $text{'acl_na'}, $text{'acl_view'}, $text{'acl_kill'}),
&display_acl_cell($acc, $name, 'v', 'V', $aclname, &display_acl_cell($acc, $name, 's', 'S', $aclname,
$text{'acl_na'}, $text{'acl_view'}, $text{'acl_kill'}); $text{'acl_na'}, $text{'acl_view'}, $text{'acl_edit'}),
&display_acl_cell($acc, $name, 's', 'S', $aclname, $stype eq 'fs' ? &display_acl_cell($acc, $name, 'p', 'P', $aclname,
$text{'acl_na'}, $text{'acl_view'}, $text{'acl_edit'}); $text{'acl_na'}, $text{'acl_view'},
$stype eq 'fs' ? &display_acl_cell($acc, $name, 'p', 'P', $aclname, $text{'acl_edit'}) : "",
$text{'acl_na'}, $text{'acl_view'}, $text{'acl_edit'}) : $stype eq 'fs' ? &display_acl_cell($acc, $name, 'n', 'N', $aclname,
print "<td> </td>\n"; $text{'acl_na'}, $text{'acl_view'},
$stype eq 'fs' ? &display_acl_cell($acc, $name, 'n', 'N', $aclname, $text{'acl_edit'}) : "",
$text{'acl_na'}, $text{'acl_view'}, $text{'acl_edit'}) : &display_acl_cell($acc, $name, 'o', 'O', $aclname,
print "<td> </td>\n"; $text{'acl_na'}, $text{'acl_view'}, $text{'acl_edit'}),
&display_acl_cell($acc, $name, 'o', 'O', $aclname, ]);
$text{'acl_na'}, $text{'acl_view'}, $text{'acl_edit'});
print "</tr>\n";
} }
#display_acl_cell(\%access, $name, #display_acl_cell(\%access, $name,
@@ -313,29 +172,12 @@ sub display_acl_cell
{ {
local ($acc, $name, $rp, $wp, $aclname, $text1, $text2, $text3) = @_; local ($acc, $name, $rp, $wp, $aclname, $text1, $text2, $text3) = @_;
local $rn = $rp . $wp . '_' . $aclname; local $rn = $rp . $wp . '_' . $aclname;
my $sel = !$acc->{$aclname} || !&perm_to($rp, $acc, $aclname) ? '' :
print "<td>\n"; &perm_to($rp.$wp, $acc, $aclname) ? $rp.$wp : $rp;
if($acc->{$aclname}) { return &ui_radio($rn, $sel,
printf "<input type=radio name=$rn value='' %s> %s<br>\n", [ [ '', $text1."<br>" ],
!&perm_to($rp, $acc, $aclname) ? [ $rp, $text2."<br>" ],
"checked" : "", $text1; [ $rp.$wp, $text3 ] ]);
printf "<input type=radio name=$rn value='$rp' %s> %s<br>\n",
&perm_to($rp, $acc, $aclname) &&
!&perm_to($rp.$wp, $acc, $aclname) ?
"checked" : "",$text2;
printf "<input type=radio name=$rn value='$rp$wp' %s> %s\n",
&perm_to($rp.$wp, $acc, $aclname) ?
"checked" : "", $text3;
}
else {
printf "<input type=radio name=$rn value='' checked> %s<br>\n",
$text1;
printf "<input type=radio name=$rn value='$rp'> %s<br>\n",
$text2;
printf "<input type=radio name=$rn value='$rp$wp'> %s\n",
$text3;
}
print "</td>\n";
} }
# perm_to($permissions_string,\%access,$ACLname) # perm_to($permissions_string,\%access,$ACLname)
+88 -178
View File
@@ -5,202 +5,112 @@ require 'sendmail-lib.pl';
# Output HTML for editing security options for the sendmail module # Output HTML for editing security options for the sendmail module
sub acl_security_form sub acl_security_form
{ {
print "<tr> <td><b>$text{'acl_opts'}</b></td> <td>\n"; my ($o) = @_;
printf "<input type=radio name=opts value=1 %s> $text{'yes'}\n",
$_[0]->{'opts'} ? "checked" : "";
printf "<input type=radio name=opts value=0 %s> $text{'no'}</td>\n",
$_[0]->{'opts'} ? "" : "checked";
print "<td><b>$text{'acl_cws'}</b></td> <td>\n"; foreach my $f ('opts', 'cws', 'masq', 'trusts', 'cgs', 'relay',
printf "<input type=radio name=cws value=1 %s> $text{'yes'}\n", 'mailers', 'access', 'domains', 'stop', 'manual') {
$_[0]->{'cws'} ? "checked" : ""; print &ui_table_row($text{'acl_'.$f},
printf "<input type=radio name=cws value=0 %s> $text{'no'}</td> </tr>\n", &ui_yesno_radio($f, $o->{$f}));
$_[0]->{'cws'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_masq'}</b></td> <td>\n";
printf "<input type=radio name=masq value=1 %s> $text{'yes'}\n",
$_[0]->{'masq'} ? "checked" : "";
printf "<input type=radio name=masq value=0 %s> $text{'no'}</td>\n",
$_[0]->{'masq'} ? "" : "checked";
print "<td><b>$text{'acl_trusts'}</b></td> <td>\n";
printf "<input type=radio name=trusts value=1 %s> $text{'yes'}\n",
$_[0]->{'trusts'} ? "checked" : "";
printf "<input type=radio name=trusts value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'trusts'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_cgs'}</b></td> <td>\n";
printf "<input type=radio name=cgs value=1 %s> $text{'yes'}\n",
$_[0]->{'cgs'} ? "checked" : "";
printf "<input type=radio name=cgs value=0 %s> $text{'no'}</td>\n",
$_[0]->{'cgs'} ? "" : "checked";
print "<td><b>$text{'acl_relay'}</b></td> <td>\n";
printf "<input type=radio name=relay value=1 %s> $text{'yes'}\n",
$_[0]->{'relay'} ? "checked" : "";
printf "<input type=radio name=relay value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'relay'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_mailers'}</b></td> <td>\n";
printf "<input type=radio name=mailers value=1 %s> $text{'yes'}\n",
$_[0]->{'mailers'} ? "checked" : "";
printf "<input type=radio name=mailers value=0 %s> $text{'no'}</td>\n",
$_[0]->{'mailers'} ? "" : "checked";
print "<td><b>$text{'acl_access'}</b></td> <td>\n";
printf "<input type=radio name=access value=1 %s> $text{'yes'}\n",
$_[0]->{'access'} ? "checked" : "";
printf "<input type=radio name=access value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'access'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_domains'}</b></td> <td>\n";
printf "<input type=radio name=domains value=1 %s> $text{'yes'}\n",
$_[0]->{'domains'} ? "checked" : "";
printf "<input type=radio name=domains value=0 %s> $text{'no'}</td>\n",
$_[0]->{'domains'} ? "" : "checked";
print "<td><b>$text{'acl_stop'}</b></td> <td>\n";
printf "<input type=radio name=stop value=1 %s> $text{'yes'}\n",
$_[0]->{'stop'} ? "checked" : "";
printf "<input type=radio name=stop value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'stop'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_manual'}</b></td> <td>\n";
printf "<input type=radio name=manual value=1 %s> $text{'yes'}\n",
$_[0]->{'manual'} ? "checked" : "";
printf "<input type=radio name=manual value=0 %s> $text{'no'}</td>\n",
$_[0]->{'manual'} ? "" : "checked";
print "<td><b>$text{'acl_mailq'}</b></td> <td><select name=mailq>\n";
printf "<option value=2 %s>$text{'acl_viewdel'}</option>\n",
$_[0]->{'mailq'} == 2 ? "selected" : "";
printf "<option value=1 %s>$text{'acl_view'}</option>\n",
$_[0]->{'mailq'} == 1 ? "selected" : "";
printf "<option value=0 %s>$text{'no'}</option>\n",
$_[0]->{'mailq'} == 0 ? "selected" : "";
print "</select></td> </tr>\n";
print "<tr> <td><b>$text{'acl_qdoms'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=qdoms_def value=1 %s> %s\n",
$_[0]->{'qdoms'} ? "" : "checked", $text{'acl_all'};
printf "<input type=radio name=qdoms_def value=0 %s> %s\n",
$_[0]->{'qdoms'} ? "checked" : "", $text{'acl_matching'};
printf "<input name=qdoms size=40 value='%s'></td> </tr>\n",
$_[0]->{'qdoms'};
print "<tr> <td><b>$text{'acl_qdomsmode'}</b></td> <td colspan=3>\n";
foreach $m (0 .. 2) {
printf "<input type=radio name=qdomsmode value=%s %s> %s\n",
$m, $_[0]->{'qdomsmode'} == $m ? "checked" : "",
$text{'acl_qdomsmode'.$m};
} }
print "</td> </tr>\n";
print "<tr> <td><b>$text{'acl_flushq'}</b></td> <td>\n"; print &ui_table_row($text{'acl_mailq'},
printf "<input type=radio name=flushq value=1 %s> $text{'yes'}\n", &ui_select("mailq",
$_[0]->{'flushq'} ? "checked" : ""; defined($o->{'mailq'}) && $o->{'mailq'} ne '' ? $o->{'mailq'} : 0,
printf "<input type=radio name=flushq value=0 %s> $text{'no'}</td>\n", [ [ 2, $text{'acl_viewdel'} ],
$_[0]->{'flushq'} ? "" : "checked"; [ 1, $text{'acl_view'} ],
[ 0, $text{'no'} ] ]));
print "<td><b>$text{'acl_ports'}</b></td> <td>\n"; print &ui_table_row($text{'acl_qdoms'},
printf "<input type=radio name=ports value=1 %s> $text{'yes'}\n", &ui_radio_table("qdoms_def", $o->{'qdoms'} ? 0 : 1,
$_[0]->{'ports'} ? "checked" : ""; [ [ 1, $text{'acl_all'} ],
printf "<input type=radio name=ports value=0 %s> $text{'no'}</td>\n", [ 0, $text{'acl_matching'},
$_[0]->{'ports'} ? "" : "checked"; &ui_textbox("qdoms", $o->{'qdoms'}, 40) ] ], 1),
3);
# Virtusers print &ui_table_row($text{'acl_qdomsmode'},
print "<tr> <td colspan=4><hr></td> </tr>\n"; &ui_radio("qdomsmode",
defined($o->{'qdomsmode'}) ? $o->{'qdomsmode'} : 0,
[ map { [ $_, $text{'acl_qdomsmode'.$_} ] } 0 .. 2 ]),
3);
print "<tr> <td valign=top><b>$text{'acl_virtusers'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_flushq'},
printf "<input type=radio name=vmode value=0 %s> $text{'acl_none'}\n", &ui_yesno_radio("flushq", $o->{'flushq'}));
$_[0]->{'vmode'} == 0 ? "checked" : ""; print &ui_table_row($text{'acl_ports'},
printf "<input type=radio name=vmode value=1 %s> $text{'acl_all'}\n", &ui_yesno_radio("ports", $o->{'ports'}));
$_[0]->{'vmode'} == 1 ? "checked" : "";
printf "<input type=radio name=vmode value=3 %s> $text{'acl_vsame'}<br>\n",
$_[0]->{'vmode'} == 3 ? "checked" : "";
printf "<input type=radio name=vmode value=2 %s> $text{'acl_matching'}\n",
$_[0]->{'vmode'} == 2 ? "checked" : "";
printf "<input name=vaddrs size=40 value='%s'></td> </tr>\n",
$_[0]->{'vaddrs'};
print "<tr> <td><b>$text{'acl_vtypes'}</b></td>\n"; print &ui_table_hr();
print "<td colspan=3>\n";
for($n=0; $n<3; $n++) {
printf "<input type=checkbox name=vedit_%s value=1 %s> %s\n",
$n, $_[0]->{"vedit_$n"} ? "checked" : "", $text{"acl_vtype$n"};
}
print "</td> </tr>\n";
print "<tr> <td><b>$text{'acl_vmax'}</b></td>\n"; print &ui_table_row($text{'acl_virtusers'},
printf "<td><input type=radio name=vmax_def value=1 %s> %s\n", &ui_radio_table("vmode",
$_[0]->{'vmax'} ? "" : "checked", $text{'acl_unlimited'}; defined($o->{'vmode'}) ? $o->{'vmode'} : 0,
printf "<input type=radio name=vmax_def value=0 %s>\n", [ [ 0, $text{'acl_none'} ],
$_[0]->{'vmax'} ? "checked" : ""; [ 1, $text{'acl_all'} ],
printf "<input name=vmax size=5 value='%s'></td>\n", [ 3, $text{'acl_vsame'} ],
$_[0]->{'vmax'}; [ 2, $text{'acl_matching'},
&ui_textbox("vaddrs", $o->{'vaddrs'}, 40) ] ], 1),
3);
print "<td><b>$text{'acl_vcatchall'}</b></td>\n"; print &ui_table_row($text{'acl_vtypes'},
print "<td>",&ui_yesno_radio("vcatchall", join("", map { &ui_checkbox("vedit_".$_, 1, $text{"acl_vtype".$_},
int($_[0]->{'vcatchall'})),"</td> </tr>\n"; $o->{"vedit_".$_}) } 0 .. 2),
3);
# Aliases print &ui_table_row($text{'acl_vmax'},
print "<tr> <td colspan=4><hr></td> </tr>\n"; &ui_radio_table("vmax_def", $o->{'vmax'} ? 0 : 1,
[ [ 1, $text{'acl_unlimited'} ],
[ 0, "", &ui_textbox("vmax", $o->{'vmax'}, 5) ] ], 1),
3);
print "<tr> <td valign=top><b>$text{'acl_aliases'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_vcatchall'},
printf "<input type=radio name=amode value=0 %s> $text{'acl_none'}\n", &ui_yesno_radio("vcatchall", int($o->{'vcatchall'})));
$_[0]->{'amode'} == 0 ? "checked" : "";
printf "<input type=radio name=amode value=1 %s> $text{'acl_all'}\n",
$_[0]->{'amode'} == 1 ? "checked" : "";
printf "<input type=radio name=amode value=3 %s> $text{'acl_asame'}<br>\n",
$_[0]->{'amode'} == 3 ? "checked" : "";
printf "<input type=radio name=amode value=2 %s> $text{'acl_matching'}\n",
$_[0]->{'amode'} == 2 ? "checked" : "";
printf "<input name=aliases size=40 value='%s'></td> </tr>\n",
$_[0]->{'aliases'};
print "<tr> <td><b>$text{'acl_atypes'}</b></td> <td colspan=3>\n"; print &ui_table_hr();
for($n=1; $n<=6; $n++) {
printf "<input type=checkbox name=aedit_%s value=1 %s> %s\n",
$n, $_[0]->{"aedit_$n"} ? "checked" : "",
$text{"acl_atype$n"};
}
print "</td> </tr>\n";
print "<tr> <td><b>$text{'acl_amax'}</b></td>\n"; print &ui_table_row($text{'acl_aliases'},
printf "<td colspan=3><input type=radio name=amax_def value=1 %s> %s\n", &ui_radio_table("amode",
$_[0]->{'amax'} ? "" : "checked", $text{'acl_unlimited'}; defined($o->{'amode'}) ? $o->{'amode'} : 0,
printf "<input type=radio name=amax_def value=0 %s>\n", [ [ 0, $text{'acl_none'} ],
$_[0]->{'amax'} ? "checked" : ""; [ 1, $text{'acl_all'} ],
printf "<input name=amax size=5 value='%s'></td> </tr>\n", [ 3, $text{'acl_asame'} ],
$_[0]->{'amax'}; [ 2, $text{'acl_matching'},
&ui_textbox("aliases", $o->{'aliases'}, 40) ] ], 1),
3);
print "<tr> <td><b>$text{'acl_apath'}</b></td>\n"; print &ui_table_row($text{'acl_atypes'},
printf "<td colspan=3><input name=apath size=40 value='%s'> %s</td> </tr>\n", join("", map { &ui_checkbox("aedit_".$_, 1, $text{"acl_atype".$_},
$_[0]->{'apath'}, &file_chooser_button("apath", 1); $o->{"aedit_".$_}) } 1 .. 6),
3);
# Outgoing address mappings print &ui_table_row($text{'acl_amax'},
print "<tr> <td colspan=4><hr></td> </tr>\n"; &ui_radio_table("amax_def", $o->{'amax'} ? 0 : 1,
[ [ 1, $text{'acl_unlimited'} ],
[ 0, "", &ui_textbox("amax", $o->{'amax'}, 5) ] ], 1),
3);
print "<tr> <td valign=top><b>$text{'acl_outgoing'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_apath'},
printf "<input type=radio name=omode value=0 %s> $text{'acl_none'}\n", &ui_textbox("apath", $o->{'apath'}, 40)." ".
$_[0]->{'omode'} == 0 ? "checked" : ""; &file_chooser_button("apath", 1),
printf "<input type=radio name=omode value=1 %s> $text{'acl_all'}<br>\n", 3);
$_[0]->{'omode'} == 1 ? "checked" : "";
printf "<input type=radio name=omode value=2 %s> $text{'acl_matching'}\n",
$_[0]->{'omode'} == 2 ? "checked" : "";
printf "<input name=oaddrs size=40 value='%s'></td> </tr>\n",
$_[0]->{'oaddrs'};
# Spam control rules print &ui_table_hr();
print "<tr> <td colspan=4><hr></td> </tr>\n";
print "<tr> <td valign=top><b>$text{'acl_spam'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_outgoing'},
printf "<input type=radio name=smode value=1 %s> $text{'acl_all'}\n", &ui_radio_table("omode",
$_[0]->{'smode'} == 1 ? "checked" : ""; defined($o->{'omode'}) ? $o->{'omode'} : 0,
printf "<input type=radio name=smode value=2 %s> $text{'acl_matching'}\n", [ [ 0, $text{'acl_none'} ],
$_[0]->{'smode'} == 2 ? "checked" : ""; [ 1, $text{'acl_all'} ],
printf "<input name=saddrs size=40 value='%s'></td> </tr>\n", [ 2, $text{'acl_matching'},
$_[0]->{'saddrs'}; &ui_textbox("oaddrs", $o->{'oaddrs'}, 40) ] ], 1),
3);
print &ui_table_hr();
print &ui_table_row($text{'acl_spam'},
&ui_radio_table("smode", $o->{'smode'},
[ [ 1, $text{'acl_all'} ],
[ 2, $text{'acl_matching'},
&ui_textbox("saddrs", $o->{'saddrs'}, 40) ] ], 1),
3);
} }
# acl_security_save(&options) # acl_security_save(&options)
+30 -36
View File
@@ -5,47 +5,41 @@ require 'servers-lib.pl';
# Output HTML for editing security options for the servers module # Output HTML for editing security options for the servers module
sub acl_security_form sub acl_security_form
{ {
print "<tr> <td valign=top><b>$text{'acl_servers'}</b></td>\n"; my ($o) = @_;
print "<td colspan=3>\n"; my @servers = sort { $a->{'host'} cmp $b->{'host'} } &list_servers();
printf "<input type=radio name=servers_def value=1 %s> %s\n", my %scan = map { $_, 1 } split(/\s+/, $o->{'servers'});
$_[0]->{'servers'} eq '*' ? 'checked' : '', $text{'acl_sall'}; my (@sopts, @ssel);
printf "<input type=radio name=servers_def value=0 %s> %s<br>\n", foreach my $s (sort { $a->{'value'} cmp $b->{'value'} } @servers) {
$_[0]->{'servers'} eq '*' ? '' : 'checked', $text{'acl_ssel'}; push(@sopts, [ $s->{'id'}, $s->{'host'} ]);
print "<select name=servers multiple size=4 width=15>\n"; push(@ssel, $s->{'id'}) if ($scan{$s->{'host'}} || $scan{$s->{'id'}});
local @servers = sort { $a->{'host'} cmp $b->{'host'} } &list_servers(); }
local ($z, %zcan);
map { $zcan{$_}++ } split(/\s+/, $_[0]->{'servers'});
foreach $z (sort { $a->{'value'} cmp $b->{'value'} } @servers) {
printf "<option value='%s' %s>%s</option>\n",
$z->{'id'},
$zcan{$z->{'host'}} || $zcan{$z->{'id'}} ? "selected" : "",
$z->{'host'} ;
}
print "</select></td></tr>\n";
print "<tr> <td><b>$text{'acl_edit'}</b></td> <td>\n"; print &ui_table_row($text{'acl_servers'},
print &ui_yesno_radio("edit", $_[0]->{'edit'}),"</td>\n"; &ui_radio("servers_def", $o->{'servers'} eq '*' ? 1 : 0,
[ [ 1, $text{'acl_sall'} ],
[ 0, $text{'acl_ssel'} ] ])."<br>\n".
&ui_select("servers", \@ssel, \@sopts, 4, 1),
3);
print "<td><b>$text{'acl_find'}</b></td> <td>\n"; print &ui_table_row($text{'acl_edit'},
print &ui_yesno_radio("find", $_[0]->{'find'}),"</td> </tr>\n"; &ui_yesno_radio("edit", $o->{'edit'}));
print &ui_table_row($text{'acl_find'},
&ui_yesno_radio("find", $o->{'find'}));
print "<tr> <td><b>$text{'acl_auto'}</b></td> <td>\n"; print &ui_table_row($text{'acl_auto'},
print &ui_yesno_radio("auto", $_[0]->{'auto'}),"</td>\n"; &ui_yesno_radio("auto", $o->{'auto'}));
print &ui_table_row($text{'acl_add'},
&ui_yesno_radio("add", $o->{'add'}));
print "<td><b>$text{'acl_add'}</b></td> <td>\n"; print &ui_table_row($text{'acl_forcefast'},
print &ui_yesno_radio("add", $_[0]->{'add'}),"</td> </tr>\n"; &ui_yesno_radio("forcefast", $o->{'forcefast'}));
print &ui_table_row($text{'acl_forcetype'},
&ui_yesno_radio("forcetype", $o->{'forcetype'}));
print "<tr> <td><b>$text{'acl_forcefast'}</b></td> <td>\n"; print &ui_table_row($text{'acl_forcelink'},
print &ui_yesno_radio("forcefast", $_[0]->{'forcefast'}),"</td>\n"; &ui_yesno_radio("forcelink", $o->{'forcelink'}));
print &ui_table_row($text{'acl_links'},
print "<td><b>$text{'acl_forcetype'}</b></td> <td>\n"; &ui_yesno_radio("links", $o->{'links'}));
print &ui_yesno_radio("forcetype", $_[0]->{'forcetype'}),"</td> </tr>\n";
print "<tr> <td><b>$text{'acl_forcelink'}</b></td> <td>\n";
print &ui_yesno_radio("forcelink", $_[0]->{'forcelink'}),"</td>\n";
print "<td><b>$text{'acl_links'}</b></td> <td>\n";
print &ui_yesno_radio("links", $_[0]->{'links'}),"</td> </tr>\n";
} }
# acl_security_save(&options) # acl_security_save(&options)
+10 -12
View File
@@ -5,20 +5,18 @@ do 'shorewall-lib.pl';
# Output HTML for editing security options for the acl module # Output HTML for editing security options for the acl module
sub acl_security_form sub acl_security_form
{ {
print "<tr> <td><b>$text{'acl_nochange'}</b></td> <td>\n"; my ($o) = @_;
printf "<input type=radio name=nochange value=0 %s> $text{'yes'}\n",
$_[0]->{'nochange'} ? '' : 'checked';
printf "<input type=radio name=nochange value=1 %s> $text{'no'}</td>\n",
$_[0]->{'nochange'} ? 'checked' : '';
print "</tr>\n"; print &ui_table_row($text{'acl_nochange'},
&ui_yesno_radio("nochange", int($o->{'nochange'}), 0, 1));
print "<tr> <td valign=top><b>$text{'acl_files'}</b></td> <td>\n"; print &ui_table_row($text{'acl_files'},
print &ui_radio("files_def", $_[0]->{'files'} eq '*' ? 1 : 0, &ui_radio("files_def", $o->{'files'} eq '*' ? 1 : 0,
[ [ 1, $text{'acl_all'} ], [ 0, $text{'acl_sel'} ] ]),"<br>\n"; [ [ 1, $text{'acl_all'} ], [ 0, $text{'acl_sel'} ] ])."<br>\n".
print &ui_select("files", [ split(/\s+/, $_[0]->{'files'}) ], &ui_select("files", [ split(/\s+/, $o->{'files'}) ],
[ map { [ $_, $text{$_."_title"}." ($_)" ] } [ map { [ $_, $text{$_."_title"}." ($_)" ] }
@shorewall_files ], 5, 1); @shorewall_files ], 5, 1),
3);
} }
# acl_security_save(&options) # acl_security_save(&options)
+10 -12
View File
@@ -5,20 +5,18 @@ do 'shorewall6-lib.pl';
# Output HTML for editing security options for the acl module # Output HTML for editing security options for the acl module
sub acl_security_form sub acl_security_form
{ {
print "<tr> <td><b>$text{'acl_nochange'}</b></td> <td>\n"; my ($o) = @_;
printf "<input type=radio name=nochange value=0 %s> $text{'yes'}\n",
$_[0]->{'nochange'} ? '' : 'checked';
printf "<input type=radio name=nochange value=1 %s> $text{'no'}</td>\n",
$_[0]->{'nochange'} ? 'checked' : '';
print "</tr>\n"; print &ui_table_row($text{'acl_nochange'},
&ui_yesno_radio("nochange", int($o->{'nochange'}), 0, 1));
print "<tr> <td valign=top><b>$text{'acl_files'}</b></td> <td>\n"; print &ui_table_row($text{'acl_files'},
print &ui_radio("files_def", $_[0]->{'files'} eq '*' ? 1 : 0, &ui_radio("files_def", $o->{'files'} eq '*' ? 1 : 0,
[ [ 1, $text{'acl_all'} ], [ 0, $text{'acl_sel'} ] ]),"<br>\n"; [ [ 1, $text{'acl_all'} ], [ 0, $text{'acl_sel'} ] ])."<br>\n".
print &ui_select("files", [ split(/\s+/, $_[0]->{'files'}) ], &ui_select("files", [ split(/\s+/, $o->{'files'}) ],
[ map { [ $_, $text{$_."_title"}." ($_)" ] } [ map { [ $_, $text{$_."_title"}." ($_)" ] }
@shorewall6_files ], 5, 1); @shorewall6_files ], 5, 1),
3);
} }
# acl_security_save(&options) # acl_security_save(&options)
+14 -20
View File
@@ -9,29 +9,23 @@ require 'squid-lib.pl';
# Output HTML for editing security options for the squid module # Output HTML for editing security options for the squid module
sub acl_security_form sub acl_security_form
{ {
print "<tr> <td valign=top><b>$text{'acl_sections'}</b></td>\n"; my ($o) = @_;
print "<td colspan=3><select name=sections multiple size=6>\n";
foreach $s (@accopts) {
printf "<option value=%s %s>%s</option>\n",
$s, $_[0]->{$s} ? 'selected' : '', $text{"index_${s}"};
}
print "</select></td> </tr>\n";
print "<tr> <td><b>$text{'acl_root'}</b></td>\n"; print &ui_table_row($text{'acl_sections'},
printf "<td colspan=3><input name=root size=40 value='%s'> %s</td> </tr>\n", &ui_select("sections",
$_[0]->{'root'}, &file_chooser_button("root", 1); [ grep { $o->{$_} } @accopts ],
[ map { [ $_, $text{"index_${_}"} ] } @accopts ],
6, 1),
3);
print "<tr> <td><b>$text{'acl_start'}</b></td>\n"; print &ui_table_row($text{'acl_root'},
printf "<td><input type=radio name=start value=1 %s> %s\n", &ui_textbox("root", $o->{'root'}, 40)." ".&file_chooser_button("root", 1),
$_[0]->{'start'} ? 'checked' : '', $text{'yes'}; 3);
printf "<input type=radio name=start value=0 %s> %s</td> </tr>\n",
$_[0]->{'start'} ? '' : 'checked', $text{'no'};
print "<tr> <td><b>$text{'acl_restart'}</b></td>\n"; print &ui_table_row($text{'acl_start'},
printf "<td><input type=radio name=restart value=1 %s> %s\n", &ui_yesno_radio("start", $o->{'start'}));
$_[0]->{'restart'} ? 'checked' : '', $text{'yes'}; print &ui_table_row($text{'acl_restart'},
printf "<input type=radio name=restart value=0 %s> %s</td> </tr>\n", &ui_yesno_radio("restart", $o->{'restart'}));
$_[0]->{'restart'} ? '' : 'checked', $text{'no'};
} }
# acl_security_save(&options) # acl_security_save(&options)
+145 -197
View File
@@ -6,225 +6,173 @@ require 'user-lib.pl';
sub acl_security_form sub acl_security_form
{ {
local $o = $_[0]; local $o = $_[0];
my $uedit_group = $o->{'uedit_mode'} == 5 ?
join(" ", map { "".&my_getgrgid($_) } split(/\s+/, $o->{'uedit'})) : "";
print "<tr> <td valign=top><b>$text{'acl_uedit'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_uedit'},
printf "<input type=radio name=uedit_mode value=0 %s> $text{'acl_uedit_all'}&nbsp;&nbsp;\n", &ui_radio_table("uedit_mode",
$o->{'uedit_mode'} == 0 ? "checked" : ""; defined($o->{'uedit_mode'}) ? $o->{'uedit_mode'} : 0,
printf "<input type=radio name=uedit_mode value=1 %s> $text{'acl_uedit_none'}&nbsp;\n", [ [ 0, $text{'acl_uedit_all'} ],
$o->{'uedit_mode'} == 1 ? "checked" : ""; [ 1, $text{'acl_uedit_none'} ],
printf "<input type=radio name=uedit_mode value=6 %s> $text{'acl_uedit_this'}<br>\n", [ 6, $text{'acl_uedit_this'} ],
$o->{'uedit_mode'} == 6 ? "checked" : ""; [ 2, $text{'acl_uedit_only'},
printf "<input type=radio name=uedit_mode value=2 %s> $text{'acl_uedit_only'}\n", &ui_textbox("uedit_can",
$o->{'uedit_mode'} == 2 ? "checked" : ""; $o->{'uedit_mode'} == 2 ? $o->{'uedit'} : "", 40).
printf "<input name=uedit_can size=40 value='%s'> %s<br>\n", " ".&user_chooser_button("uedit_can", 1) ],
$o->{'uedit_mode'} == 2 ? $o->{'uedit'} : "", [ 3, $text{'acl_uedit_except'},
&user_chooser_button("uedit_can", 1); &ui_textbox("uedit_cannot",
printf "<input type=radio name=uedit_mode value=3 %s> $text{'acl_uedit_except'}\n", $o->{'uedit_mode'} == 3 ? $o->{'uedit'} : "", 40).
$o->{'uedit_mode'} == 3 ? "checked" : ""; " ".&user_chooser_button("uedit_cannot", 1) ],
printf "<input name=uedit_cannot size=40 value='%s'> %s<br>\n", [ 4, $text{'acl_uedit_uid'},
$o->{'uedit_mode'} == 3 ? $o->{'uedit'} : "", &ui_textbox("uedit_uid",
&user_chooser_button("uedit_cannot", 1); $o->{'uedit_mode'} == 4 ? $o->{'uedit'} : "", 6).
printf "<input type=radio name=uedit_mode value=4 %s> $text{'acl_uedit_uid'}\n", " - ".&ui_textbox("uedit_uid2",
$o->{'uedit_mode'} == 4 ? "checked" : ""; $o->{'uedit_mode'} == 4 ? $o->{'uedit2'} : "", 6) ],
printf "<input name=uedit_uid size=6 value='%s'> - \n", [ 5, $text{'acl_uedit_group'},
$o->{'uedit_mode'} == 4 ? $o->{'uedit'} : ""; &ui_textbox("uedit_group", $uedit_group, 40)." ".
printf "<input name=uedit_uid2 size=6 value='%s'><br>\n", &group_chooser_button("uedit_group", 1)."<br>\n".
$o->{'uedit_mode'} == 4 ? $o->{'uedit2'} : ""; &ui_checkbox("uedit_sec", 1, $text{'acl_uedit_sec'},
printf "<input type=radio name=uedit_mode value=5 %s> $text{'acl_uedit_group'}\n", $o->{'uedit_sec'}) ],
$o->{'uedit_mode'} == 5 ? "checked" : ""; [ 7, $text{'acl_uedit_re'},
printf "<input name=uedit_group size=40 value='%s'> %s<br>\n", &ui_textbox("uedit_re",
$o->{'uedit_mode'} == 5 ? $o->{'uedit_mode'} == 7 ? $o->{'uedit_re'} : "", 40) ] ], 1),
join(" ", map { "".&my_getgrgid($_) } split(/\s+/, $o->{'uedit'})) :"", 3);
&group_chooser_button("uedit_group", 1);
printf "%s <input type=checkbox name=uedit_sec value=1 %s> %s<br>\n",
"&nbsp;" x 5, $o->{'uedit_sec'} ? 'checked' : '',$text{'acl_uedit_sec'};
printf "<input type=radio name=uedit_mode value=7 %s> $text{'acl_uedit_re'}\n",
$o->{'uedit_mode'} == 7 ? "checked" : "";
printf "<input name=uedit_re size=40 value='%s'> %s<br>\n",
$o->{'uedit_mode'} == 7 ? $o->{'uedit_re'} : "";
print "</td> </tr>\n";
print "<tr> <td><b>$text{'acl_ucreate'}</b></td> <td>\n"; print &ui_table_row($text{'acl_ucreate'},
printf "<input type=radio name=ucreate value=1 %s> $text{'yes'}\n", &ui_yesno_radio("ucreate", $o->{'ucreate'}));
$o->{'ucreate'} ? "checked" : ""; print &ui_table_row($text{'acl_batch'},
printf "<input type=radio name=ucreate value=0 %s> $text{'no'}</td> </tr>\n", &ui_yesno_radio("batch", $o->{'batch'}));
$o->{'ucreate'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_batch'}</b></td> <td>\n"; print &ui_table_row($text{'acl_export'},
printf "<input type=radio name=batch value=1 %s> $text{'yes'}\n", &ui_radio("export", defined($o->{'export'}) ? $o->{'export'} : 0,
$o->{'batch'} ? "checked" : ""; [ [ 2, $text{'yes'} ],
printf "<input type=radio name=batch value=0 %s> $text{'no'}</td> </tr>\n", [ 1, $text{'acl_export1'} ],
$o->{'batch'} ? "" : "checked"; [ 0, $text{'no'} ] ]),
3);
print "<tr> <td><b>$text{'acl_export'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_uid'},
printf "<input type=radio name=export value=2 %s> $text{'yes'}\n", &ui_textbox("lowuid", $o->{'lowuid'}, 6)." - ".
$o->{'export'} == 2 ? "checked" : ""; &ui_textbox("hiuid", $o->{'hiuid'}, 6)."<br>\n".
printf "<input type=radio name=export value=1 %s> $text{'acl_export1'}\n", join("<br>", map { &ui_checkbox($_, 1, $text{'acl_'.$_}, $o->{$_}) }
$o->{'export'} == 1 ? "checked" : ""; ('autouid', 'calcuid', 'useruid', 'umultiple', 'uuid')),
printf "<input type=radio name=export value=0 %s> $text{'no'}</td> </tr>\n", 3);
$o->{'export'} == 0 ? "checked" : "";
print "<tr> <td valign=top><b>$text{'acl_uid'}</b></td>\n";
print "<td colspan=3><input name=lowuid size=6 value='$o->{'lowuid'}'> -\n";
print "<input name=hiuid size=6 value='$o->{'hiuid'}'><br>\n";
printf "<input type=checkbox name=autouid value=1 %s> %s<br>\n",
$o->{'autouid'} ? "checked" : "", $text{'acl_autouid'};
printf "<input type=checkbox name=calcuid value=1 %s> %s<br>\n",
$o->{'calcuid'} ? "checked" : "", $text{'acl_calcuid'};
printf "<input type=checkbox name=useruid value=1 %s> %s<br>\n",
$o->{'useruid'} ? "checked" : "", $text{'acl_useruid'};
printf "<input type=checkbox name=umultiple value=1 %s> %s<br>\n",
$o->{'umultiple'} ? "checked" : "", $text{'acl_umultiple'};
printf "<input type=checkbox name=uuid value=1 %s> %s</td> </tr>\n",
$o->{'uuid'} ? "checked" : "", $text{'acl_uuid'};
local $uedit_gmode = defined($o->{'uedit_gmode'}) ? $o->{'uedit_gmode'} : local $uedit_gmode = defined($o->{'uedit_gmode'}) ? $o->{'uedit_gmode'} :
$o->{'ugroups'} eq '*' ? 0 : 2; $o->{'ugroups'} eq '*' ? 0 : 2;
print "<tr> <td valign=top><b>$text{'acl_ugroups'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=uedit_gmode value=0 %s> $text{'acl_gedit_all'}<br>\n",
$uedit_gmode == 0 ? "checked" : "";
printf "<input type=radio name=uedit_gmode value=2 %s> $text{'acl_gedit_only'}\n",
$uedit_gmode == 2 ? "checked" : "";
printf "<input name=uedit_gcan size=40 value='%s'> %s<br>\n",
$uedit_gmode == 2 ? $o->{'ugroups'} : "",
&group_chooser_button("uedit_gcan", 1);
printf "<input type=radio name=uedit_gmode value=3 %s> $text{'acl_gedit_except'}\n",
$uedit_gmode == 3 ? "checked" : "";
printf "<input name=uedit_gcannot size=40 value='%s'> %s<br>\n",
$uedit_gmode == 3 ? $o->{'ugroups'} : "",
&group_chooser_button("uedit_gcannot", 1);
printf "<input type=radio name=uedit_gmode value=4 %s> $text{'acl_gedit_gid'}\n",
$uedit_gmode == 4 ? "checked" : "";
printf "<input name=uedit_gid size=6 value='%s'> -\n",
$uedit_gmode == 4 ? $o->{'ugroups'} : "";
printf "<input name=uedit_gid2 size=6 value='%s'></td> </tr>\n",
$uedit_gmode == 4 ? $o->{'ugroups2'} : "";
print "<tr> <td valign=top><b>$text{'acl_shells'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_ugroups'},
printf "<input type=radio name=shells_def value=1 %s> $text{'acl_any'}\n", &ui_radio_table("uedit_gmode", $uedit_gmode,
$o->{'shells'} eq "*" ? "checked" : ""; [ [ 0, $text{'acl_gedit_all'} ],
printf "<input type=radio name=shells_def value=0 %s> $text{'acl_listed'}<br>\n", [ 2, $text{'acl_gedit_only'},
$o->{'shells'} eq "*" ? "" : "checked"; &ui_textbox("uedit_gcan",
print "<textarea name=shells rows=3 cols=40>", $uedit_gmode == 2 ? $o->{'ugroups'} : "", 40).
$o->{'shells'} eq "*" ? "" : join("\n", split(/\s+/, $o->{'shells'})), " ".&group_chooser_button("uedit_gcan", 1) ],
"</textarea></td> </tr>\n"; [ 3, $text{'acl_gedit_except'},
&ui_textbox("uedit_gcannot",
$uedit_gmode == 3 ? $o->{'ugroups'} : "", 40).
" ".&group_chooser_button("uedit_gcannot", 1) ],
[ 4, $text{'acl_gedit_gid'},
&ui_textbox("uedit_gid",
$uedit_gmode == 4 ? $o->{'ugroups'} : "", 6).
" - ".&ui_textbox("uedit_gid2",
$uedit_gmode == 4 ? $o->{'ugroups2'} : "", 6) ] ], 1),
3);
print "<tr> <td><b>$text{'acl_epeopt'}</b></td> <td>\n"; print &ui_table_row($text{'acl_shells'},
printf "<input type=radio name=peopt value=1 %s> $text{'yes'}\n", &ui_radio_table("shells_def", $o->{'shells'} eq "*" ? 1 : 0,
$o->{'peopt'} ? "checked" : ""; [ [ 1, $text{'acl_any'} ],
printf "<input type=radio name=peopt value=0 %s> $text{'no'}</td> </tr>\n", [ 0, $text{'acl_listed'},
$o->{'peopt'} ? "" : "checked"; &ui_textarea("shells",
$o->{'shells'} eq "*" ? "" :
join("\n", split(/\s+/, $o->{'shells'} || "")),
3, 40) ] ], 1),
3);
print "<tr> <td valign=top><b>$text{'acl_home'}</b></td>\n"; print &ui_table_row($text{'acl_epeopt'},
printf "<td colspan=3><input name=home size=40 value='%s'> %s<br>\n", &ui_yesno_radio("peopt", $o->{'peopt'}));
$o->{'home'}, &file_chooser_button("home", 1);
printf "<input type=checkbox name=autohome value=1 %s> %s</td> </tr>\n",
$o->{'autohome'} ? "checked" : "",
$text{'acl_autohome'};
print "<tr> <td><b>$text{'acl_udelete'}</b></td> <td>\n"; print &ui_table_row($text{'acl_home'},
printf "<input type=radio name=udelete value=1 %s> $text{'yes'}\n", &ui_textbox("home", $o->{'home'}, 40)." ".
$o->{'udelete'} ? "checked" : ""; &file_chooser_button("home", 1)."<br>\n".
printf "<input type=radio name=udelete value=0 %s> $text{'no'}</td> </tr>\n", &ui_checkbox("autohome", 1, $text{'acl_autohome'}, $o->{'autohome'}),
$o->{'udelete'} ? "" : "checked"; 3);
print "<tr> <td><b>$text{'acl_urename'}</b></td> <td>\n"; print &ui_table_row($text{'acl_udelete'},
printf "<input type=radio name=urename value=1 %s> $text{'yes'}\n", &ui_yesno_radio("udelete", $o->{'udelete'}));
$o->{'urename'} ? "checked" : ""; print &ui_table_row($text{'acl_urename'},
printf "<input type=radio name=urename value=0 %s> $text{'no'}</td> </tr>\n", &ui_yesno_radio("urename", $o->{'urename'}));
$o->{'urename'} ? "" : "checked";
print "<tr> <td valign=top><b>$text{'acl_delhome'}</b></td>\n"; print &ui_table_row($text{'acl_delhome'},
print "<td colspan=3>",&ui_radio("delhome", $o->{'delhome'}, &ui_radio("delhome", $o->{'delhome'},
[ [ 2, $text{'acl_option'} ], [ [ 2, $text{'acl_option'} ],
[ 1, $text{'acl_always'} ], [ 1, $text{'acl_always'} ],
[ 0, $text{'acl_never'} ] ]),"</td> </tr>\n"; [ 0, $text{'acl_never'} ] ]),
3);
# 0 = always on, 1 = can edit, 2 = always off print &ui_table_span($text{'acl_saveopts'});
print "<tr> <td valign=top><b>$text{'acl_saveopts'}</b></td> ", foreach my $opt ('chuid', 'chgid', 'movehome', 'mothers',
"<td colspan=3><table>\n"; 'makehome', 'copy', 'cothers', 'dothers') {
foreach $opt ('chuid', 'chgid', 'movehome', 'mothers', print &ui_table_row($text{"uedit_$opt"},
'makehome', 'copy', 'cothers', 'dothers') { &ui_radio($opt, defined($o->{$opt}) ? $o->{$opt} : 0,
print "<tr> <td>",$text{"uedit_$opt"},"</td>\n"; [ [ 1, $text{'acl_canedit'} ],
printf "<td><input type=radio name=$opt value=1 %s> %s\n", [ 0, $text{'acl_on'} ],
$o->{$opt} == 1 ? "checked" : "", $text{'acl_canedit'}; [ 2, $text{'acl_off'} ] ]),
printf "<input type=radio name=$opt value=0 %s> %s\n", 3);
$o->{$opt} == 0 ? "checked" : "", $text{'acl_on'};
printf "<input type=radio name=$opt value=2 %s> %s</td> </tr>\n",
$o->{$opt} == 2 ? "checked" : "", $text{'acl_off'};
} }
print "</table></td> </tr>\n";
print "<tr> <td colspan=4><hr></td> </tr>\n"; print &ui_table_hr();
print "<tr> <td valign=top><b>$text{'acl_gedit'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_gedit'},
printf "<input type=radio name=gedit_mode value=0 %s> $text{'acl_gedit_all'}&nbsp;&nbsp;\n", &ui_radio_table("gedit_mode",
$o->{'gedit_mode'} == 0 ? "checked" : ""; defined($o->{'gedit_mode'}) ? $o->{'gedit_mode'} : 0,
printf "<input type=radio name=gedit_mode value=1 %s> $text{'acl_gedit_none'}<br>\n", [ [ 0, $text{'acl_gedit_all'} ],
$o->{'gedit_mode'} == 1 ? "checked" : ""; [ 1, $text{'acl_gedit_none'} ],
printf "<input type=radio name=gedit_mode value=2 %s> $text{'acl_gedit_only'}\n", [ 2, $text{'acl_gedit_only'},
$o->{'gedit_mode'} == 2 ? "checked" : ""; &ui_textbox("gedit_can",
printf "<input name=gedit_can size=40 value='%s'> %s<br>\n", $o->{'gedit_mode'} == 2 ? $o->{'gedit'} : "", 40).
$o->{'gedit_mode'} == 2 ? $o->{'gedit'} : "", " ".&group_chooser_button("gedit_can", 1) ],
&group_chooser_button("gedit_can", 1); [ 3, $text{'acl_gedit_except'},
printf "<input type=radio name=gedit_mode value=3 %s> $text{'acl_gedit_except'}\n", &ui_textbox("gedit_cannot",
$o->{'gedit_mode'} == 3 ? "checked" : ""; $o->{'gedit_mode'} == 3 ? $o->{'gedit'} : "", 40).
printf "<input name=gedit_cannot size=40 value='%s'> %s<br>\n", " ".&group_chooser_button("gedit_cannot", 1) ],
$o->{'gedit_mode'} == 3 ? $o->{'gedit'} : "", [ 4, $text{'acl_gedit_gid'},
&group_chooser_button("gedit_cannot", 1); &ui_textbox("gedit_gid",
printf "<input type=radio name=gedit_mode value=4 %s> $text{'acl_gedit_gid'}\n", $o->{'gedit_mode'} == 4 ? $o->{'gedit'} : "", 6).
$o->{'gedit_mode'} == 4 ? "checked" : ""; " - ".&ui_textbox("gedit_gid2",
printf "<input name=gedit_gid size=6 value='%s'> -\n", $o->{'gedit_mode'} == 4 ? $o->{'gedit2'} : "", 6) ] ], 1),
$o->{'gedit_mode'} == 4 ? $o->{'gedit'} : ""; 3);
printf "<input name=gedit_gid2 size=6 value='%s'></td> </tr>\n",
$o->{'gedit_mode'} == 4 ? $o->{'gedit2'} : "";
print "<tr> <td><b>$text{'acl_gcreate'}</b></td> <td colspan=3>\n"; print &ui_table_row($text{'acl_gcreate'},
printf "<input type=radio name=gcreate value=1 %s> $text{'yes'}\n", &ui_radio("gcreate", defined($o->{'gcreate'}) ? $o->{'gcreate'} : 0,
$o->{'gcreate'}==1 ? "checked" : ""; [ [ 1, $text{'yes'} ],
printf "<input type=radio name=gcreate value=2 %s> $text{'acl_gnew'}\n", [ 2, $text{'acl_gnew'} ],
$o->{'gcreate'}==2 ? "checked" : ""; [ 0, $text{'no'} ] ]),
printf "<input type=radio name=gcreate value=0 %s> $text{'no'}</td> </tr>\n", 3);
$o->{'gcreate'}==0 ? "checked" : "";
print "<tr> <td valign=top><b>$text{'acl_gid'}</b></td>\n"; print &ui_table_row($text{'acl_gid'},
print "<td colspan=3><input name=lowgid size=6 value='$o->{'lowgid'}'> -\n"; &ui_textbox("lowgid", $o->{'lowgid'}, 6)." - ".
print "<input name=higid size=6 value='$o->{'higid'}'><br>\n"; &ui_textbox("higid", $o->{'higid'}, 6)."<br>\n".
printf "<input type=checkbox name=autogid value=1 %s> %s<br>\n", join("<br>", map { &ui_checkbox($_, 1, $text{'acl_'.$_}, $o->{$_}) }
$o->{'autogid'} ? "checked" : "", $text{'acl_autogid'}; ('autogid', 'calcgid', 'usergid', 'gmultiple', 'ggid')),
printf "<input type=checkbox name=calcgid value=1 %s> %s<br>\n", 3);
$o->{'calcgid'} ? "checked" : "", $text{'acl_calcgid'};
printf "<input type=checkbox name=usergid value=1 %s> %s<br>\n",
$o->{'usergid'} ? "checked" : "", $text{'acl_usergid'};
printf "<input type=checkbox name=gmultiple value=1 %s> %s<br>\n",
$o->{'gmultiple'} ? "checked" : "", $text{'acl_gmultiple'};
printf "<input type=checkbox name=ggid value=1 %s> %s</td> </tr>\n",
$o->{'ggid'} ? "checked" : "", $text{'acl_ggid'};
print "<tr> <td><b>$text{'acl_gdelete'}</b></td> <td>\n"; print &ui_table_row($text{'acl_gdelete'},
printf "<input type=radio name=gdelete value=1 %s> $text{'yes'}\n", &ui_yesno_radio("gdelete", $o->{'gdelete'}));
$o->{'gdelete'} ? "checked" : ""; print &ui_table_row($text{'acl_grename'},
printf "<input type=radio name=gdelete value=0 %s> $text{'no'}</td> </tr>\n", &ui_yesno_radio("grename", $o->{'grename'}));
$o->{'gdelete'} ? "" : "checked";
print "<tr> <td><b>$text{'acl_grename'}</b></td> <td>\n"; print &ui_table_hr();
printf "<input type=radio name=grename value=1 %s> $text{'yes'}\n",
$o->{'grename'} ? "checked" : "";
printf "<input type=radio name=grename value=0 %s> $text{'no'}</td> </tr>\n",
$o->{'grename'} ? "" : "checked";
print "<tr> <td colspan=4><hr></td> </tr>\n"; my $logins_mode = !$o->{'logins'} ? 0 : $o->{'logins'} eq "*" ? 1 : 2;
print &ui_table_row($text{'acl_logins'},
print "<tr><td valign=top><b>$text{'acl_logins'}</b></td> <td colspan=3>\n"; &ui_radio_table("logins_mode", $logins_mode,
printf "<input type=radio name=logins_mode value=0 %s> $text{'acl_lnone'}<br>\n", [ [ 0, $text{'acl_lnone'} ],
$o->{'logins'} ? "" : "checked"; [ 1, $text{'acl_lall'} ],
printf "<input type=radio name=logins_mode value=1 %s> $text{'acl_lall'}<br>\n", [ 2, "",
$o->{'logins'} eq "*" ? "checked" : ""; &ui_textbox("logins",
printf "<input type=radio name=logins_mode value=2 %s>\n", $logins_mode == 2 ? $o->{'logins'} : "", 40)." ".
$o->{'logins'} =~ /[^\*]/ ? "checked" : ""; &user_chooser_button("logins", 1) ] ], 1),
printf "<input name=logins size=40 value='%s'> %s</td> </tr>\n", 3);
$o->{'logins'} =~ /[^\*]/ ? $o->{'logins'} : "",
&user_chooser_button("logins", 1);
} }
# acl_security_save(&options) # acl_security_save(&options)