Merge remote-tracking branch 'origin/master'

This commit is contained in:
iliajie
2022-11-06 19:05:37 +02:00
3 changed files with 57 additions and 92 deletions

View File

@@ -5,58 +5,39 @@ do 'burner-lib.pl';
# Output HTML for editing security options for the acl module
sub acl_security_form
{
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>\n",
$_[0]->{'create'} ? '' : 'checked';
my ($o) = @_;
print &ui_table_row($text{'acl_create'},
&ui_yesno_radio("create", $o->{'create'}));
print "<td><b>$text{'acl_edit'}</b></td> <td>\n";
printf "<input type=radio name=edit value=1 %s> $text{'yes'}\n",
$_[0]->{'edit'} ? 'checked' : '';
printf "<input type=radio name=edit value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'edit'} ? '' : 'checked';
print &ui_table_row($text{'acl_edit'},
&ui_yesno_radio("edit", $o->{'edit'}));
print "<tr> <td><b>$text{'acl_global'}</b></td> <td>\n";
printf "<input type=radio name=global value=1 %s> $text{'yes'}\n",
$_[0]->{'global'} ? 'checked' : '';
printf "<input type=radio name=global value=0 %s> $text{'no'}</td>\n",
$_[0]->{'global'} ? '' : 'checked';
print "</tr>\n";
print &ui_table_row($text{'acl_global'},
&ui_yesno_radio("global", $o->{'global'}));
print "<tr> <td valign=top><b>$text{'acl_profiles'}</b></td>\n";
print "<td colspan=3>\n";
printf "<input type=radio name=all value=1 %s> %s\n",
$_[0]->{'profiles'} eq "*" ? "checked" : "", $text{'acl_all'};
printf "<input type=radio name=all value=0 %s> %s<br>\n",
$_[0]->{'profiles'} eq "*" ? "" : "checked", $text{'acl_sel'};
print "<select name=profiles multiple size=5>\n";
local $p;
local %can = map { $_, 1 } split(/\s+/, $_[0]->{'profiles'});
foreach $p (&list_profiles()) {
printf "<option value=%s %s>%s (%s)\n",
$p->{'id'}, $can{$p->{'id'}} ? "selected" : "",
$text{'index_type'.$p->{'type'}},
$p->{'type'} == 1 ? $p->{'iso'} :
$p->{'type'} == 4 ? $p->{'sdesc'} : $p->{'source_0'}.
($p->{'source_1'} ? ", ..." : "");
}
print "</select></td> </tr>\n";
print &ui_table_row($text{'acl_profiles'},
&ui_radio("all", $o->{'profiles'} eq '*' ? 1 : 0,
[ [ 1, $text{'acl_all'} ],
[ 0, $text{'acl_sel'}."<br>" ] ])."\n".
&ui_select("profiles",
[ split(/\s+/, $o->{'profiles'}) ],
[ map { [ $_->{'id'}, $text{'index_type'.$_->{'type'}} ] }
&list_profiles() ],
5, 1), 3);
print "<tr> <td><b>$text{'acl_dirs'}</b></td> <td colspan=2>\n";
printf "<input name=dirs size=40 value='%s'></td> </tr>\n",
$_[0]->{'dirs'};
print &ui_table_row($text{'acl_dirs'},
&ui_textbox("dirs", $o->{'dirs'}, 60), 3);
}
# acl_security_save(&options)
# Parse the form for security options for the acl module
sub acl_security_save
{
$_[0]->{'create'} = $in{'create'};
$_[0]->{'edit'} = $in{'edit'};
$_[0]->{'global'} = $in{'global'};
$_[0]->{'profiles'} = $in{'all'} ? "*" :
join(" ", split(/\0/, $in{'profiles'}));
$_[0]->{'dirs'} = $in{'dirs'};
my ($o) = @_;
$o->{'create'} = $in{'create'};
$o->{'edit'} = $in{'edit'};
$o->{'global'} = $in{'global'};
$o->{'profiles'} = $in{'all'} ? "*" : join(" ", split(/\0/, $in{'profiles'}));
$o->{'dirs'} = $in{'dirs'};
}

View File

@@ -5,40 +5,33 @@ require 'fdisk-lib.pl';
# Output HTML for editing security options for the fdisk module
sub acl_security_form
{
local @dlist = &list_disks_partitions();
local ($d, %dcan);
map { $dcan{$_}++ } split(/\s+/, $_[0]->{'disks'});
print "<tr> <td valign=top><b>$text{'acl_disks'}</b></td> <td>\n";
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) {
printf "<option value='%s' %s>%s</option>\n",
$d->{'device'},
$dcan{$d->{'device'}} ? "selected" : "",
&text('select_device', uc($d->{'type'}), uc(substr($d->{'device'}, -1))).($d->{'model'} ? " ($d->{'model'})" : "");
}
print "</select></td> </tr>\n";
my ($o) = @_;
my @dlist = &list_disks_partitions();
print "<tr> <td><b>$text{'acl_view'}</b></td>\n";
printf "<td><input type=radio name=view value=1 %s> %s\n",
$_[0]->{'view'} ? 'checked' : '', $text{'yes'};
printf "<input type=radio name=view value=0 %s> %s</td> </tr>\n",
$_[0]->{'view'} ? '' : 'checked', $text{'no'};
print &ui_table_row($text{'acl_disks'},
&ui_radio("disks_def", $o->{'disks'} eq '*' ? 1 : 0,
[ [ 1, $text{'acl_dall'} ],
[ 0, $text{'acl_dsel'} ] ])."<br>\n".
&ui_select("disks",
[ split(/\s+/, $o->{'disks'}) ],
[ map { [ $_->{'device'}, &text('select_device', uc($_->{'type'}), uc(substr($_->{'device'}, -1))).($_->{'model'} ? " ($_->{'model'})" : "") ] } @dlist ],
4, 1), 3);
print &ui_table_row($text{'acl_view'},
&ui_yesno_radio("view", $o->{'view'}));
}
# acl_security_save(&options)
# Parse the form for security options for the fdisk module
sub acl_security_save
{
my ($o) = @_;
if ($in{'disks_def'}) {
$_[0]->{'disks'} = "*";
$o->{'disks'} = "*";
}
else {
$_[0]->{'disks'} = join(" ", split(/\0/, $in{'disks'}));
$o->{'disks'} = join(" ", split(/\0/, $in{'disks'}));
}
$_[0]->{'view'} = $in{'view'};
$o->{'view'} = $in{'view'};
}

View File

@@ -5,40 +5,31 @@ require 'init-lib.pl';
# Output HTML for editing security options for the init module
sub acl_security_form
{
if ($config{'local_script'}) {
print "<tr> <td><b>$text{'acl_script'}</b></td> <td colspan=3>\n";
}
else {
print "<tr> <td><b>$text{'acl_actions'}</b></td> <td colspan=3>\n";
}
printf "<input type=radio name=bootup value=1 %s> $text{'yes'}\n",
$_[0]->{'bootup'} == 1 ? "checked" : "";
my ($o) = @_;
my $msg = $config{'local_script'} ? $text{'acl_script'} : $text{'acl_actions'};
my @opts = ( [ 1, $text{'yes'} ] );
if (!$config{'local_script'}) {
printf "<input type=radio name=bootup value=2 %s> $text{'acl_runonly'}\n",
$_[0]->{'bootup'} == 2 ? "checked" : "";
push(@opts, [ 2, $text{'acl_runonly'} ]);
}
printf "<input type=radio name=bootup value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'bootup'} == 0 ? "checked" : "";
push(@opts, [ 0, $text{'no'} ]);
print &ui_table_row($msg,
&ui_radio("bootup", $o->{'bootup'}, \@opts));
print "<tr> <td><b>$text{'acl_reboot'}</b></td> <td>\n";
printf "<input type=radio name=reboot value=1 %s> $text{'yes'}\n",
$_[0]->{'reboot'} ? "checked" : "";
printf "<input type=radio name=reboot value=0 %s> $text{'no'}</td>\n",
$_[0]->{'reboot'} ? "" : "checked";
print &ui_table_row($text{'acl_reboot'},
&ui_yesno_radio("reboot", $o->{'reboot'}));
print "<td><b>$text{'acl_shutdown'}</b></td> <td>\n";
printf "<input type=radio name=shutdown value=1 %s> $text{'yes'}\n",
$_[0]->{'shutdown'} ? "checked" : "";
printf "<input type=radio name=shutdown value=0 %s> $text{'no'}</td> </tr>\n",
$_[0]->{'shutdown'} ? "" : "checked";
print &ui_table_row($text{'acl_shutdown'},
&ui_yesno_radio("shutdown", $o->{'shutdown'}));
}
# acl_security_save(&options)
# Parse the form for security options for the init module
sub acl_security_save
{
$_[0]->{'bootup'} = $in{'bootup'};
$_[0]->{'reboot'} = $in{'reboot'};
$_[0]->{'shutdown'} = $in{'shutdown'};
my ($o) = @_;
$o->{'bootup'} = $in{'bootup'};
$o->{'reboot'} = $in{'reboot'};
$o->{'shutdown'} = $in{'shutdown'};
}