mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Use new UI for user conversion form, and allow selection of users to convert
This commit is contained in:
@@ -16,31 +16,37 @@ require './samba-lib.pl';
|
||||
print &text('convert_msg', 'conf_pass.cgi'),"\n";
|
||||
print "$text{'convert_ncdesc'}<p>\n";
|
||||
|
||||
print "<form action=make_epass.cgi>\n";
|
||||
print &ui_form_start("make_epass.cgi", "post");
|
||||
print &ui_table_start(undef, undef, 2);
|
||||
|
||||
print "<input type=checkbox name=skip value=1 checked> ",
|
||||
$text{'convert_noconv'};
|
||||
print "<input name=skip_list size=40 value=\"$config{dont_convert}\"> ",
|
||||
&user_chooser_button("skip_list", 1),"<p>\n";
|
||||
print &ui_table_row($text{'convert_who'},
|
||||
&ui_radio_table("who", 1,
|
||||
[ [ 0, $text{'convert_who0'},
|
||||
&ui_textbox("include_list", undef, 40)." ".
|
||||
user_chooser_button("include_list", 1) ],
|
||||
[ 1, $text{'convert_who1'},
|
||||
&ui_textbox("skip_list", $config{'dont_convert'}, 40)." ".
|
||||
&user_chooser_button("skip_list", 1) ],
|
||||
]));
|
||||
|
||||
print "<input type=checkbox name=update value=1 checked> ",
|
||||
$text{'convert_update'}," <p>\n";
|
||||
print &ui_table_row($text{'convert_update'},
|
||||
&ui_yesno_radio("update", 1));
|
||||
|
||||
print "<input type=checkbox name=add value=1 checked> ",
|
||||
$text{'convert_add'},"<p>\n";
|
||||
print &ui_table_row($text{'convert_add'},
|
||||
&ui_yesno_radio("add", 1));
|
||||
|
||||
print "<input type=checkbox name=delete value=1> ",
|
||||
$text{'convert_delete'}, "<p>\n";
|
||||
print &ui_table_row($text{'convert_delete'},
|
||||
&ui_yesno_radio("delete", 0));
|
||||
|
||||
print "<table> <tr>\n";
|
||||
print "<td valign=top>$text{'convert_newuser'}</td>\n";
|
||||
print "<td><input type=radio name=newmode value=0 checked>$text{'convert_nopasswd'}<br>\n";
|
||||
print "<input type=radio name=newmode value=1>$text{'convert_lock'}<br>\n";
|
||||
print "<input type=radio name=newmode value=2>$text{'convert_passwd'}\n",
|
||||
"<input type=password name=newpass size=20></td>\n";
|
||||
print "</tr> </table>\n";
|
||||
print &ui_table_row($text{'convert_newuser'},
|
||||
&ui_radio_table("newmode", 0,
|
||||
[ [ 0, $text{'convert_nopasswd'} ],
|
||||
[ 1, $text{'convert_lock'} ],
|
||||
[ 2, $text{'convert_passwd'},
|
||||
&ui_password("newpass", undef, 20) ] ]));
|
||||
|
||||
print "<input type=submit value=\"$text{'convert_convert'}\"> </form>\n";
|
||||
print &ui_table_end();
|
||||
print &ui_form_end([ [ undef, $text{'convert_convert'} ] ]);
|
||||
|
||||
&ui_print_footer("", $text{'index_sharelist'});
|
||||
|
||||
|
||||
@@ -85,6 +85,9 @@ convert_lock=Account locked
|
||||
convert_passwd=Use this password
|
||||
convert_convert=Convert Users
|
||||
convert_cannot=Unix users cannot be converted to Samba users
|
||||
convert_who=Unix users to convert
|
||||
convert_who0=Only listed users or UID ranges
|
||||
convert_who1=All except listed users and UID ranges
|
||||
|
||||
misc_title=Miscellaneous Options
|
||||
misc_debug=Debug Level
|
||||
|
||||
@@ -23,6 +23,7 @@ map { $suser{$_->{'name'}} = $_ } @ulist;
|
||||
|
||||
print "$text{'mkpass_msg'}<p>\n";
|
||||
@skip = split(/[ \t,]/ , $in{"skip_list"});
|
||||
@include = split(/[ \t,]/ , $in{"include_list"});
|
||||
print "<table border width=100%><tr><td bgcolor=#c0c0c0><pre>\n";
|
||||
setpwent();
|
||||
while(@uinfo = getpwent()) {
|
||||
@@ -33,22 +34,8 @@ while(@uinfo = getpwent()) {
|
||||
local $su = $suser{$uinfo[0]};
|
||||
|
||||
# Check if this user would be skipped
|
||||
local $skipme;
|
||||
foreach $s (@skip) {
|
||||
if ($s eq $uinfo[0]) { $skipme++; }
|
||||
elsif ($s =~ /^(\d+)$/ && $s == $uinfo[2]) { $skipme++; }
|
||||
elsif ($s =~ /^(\d+)\-(\d+)$/ &&
|
||||
$uinfo[2] >= $1 && $uinfo[2] <= $2) { $skipme++; }
|
||||
elsif ($s =~ /^(\d+)\-$/ && $uinfo[2] >= $1) { $skipme++; }
|
||||
elsif ($s =~ /^\-(\d+)$/ && $uinfo[2] <= $1) { $skipme++; }
|
||||
elsif ($s =~ /^\@(.*)$/) {
|
||||
local @ginfo = getgrnam($1);
|
||||
local @mems = split(/\s+/, $ginfo[3]);
|
||||
$skipme++ if ($uinfo[3] == $ginfo[2] ||
|
||||
&indexof($uinfo[0], @mems) >= 0);
|
||||
}
|
||||
}
|
||||
if ($skipme) {
|
||||
if ($in{'who'} == 1 && &check_user_list(\@uinfo, \@skip) ||
|
||||
$in{'who'} == 0 && !&check_user_list(\@uinfo, \@include)) {
|
||||
$m = "$huinfo $text{'mkpass_skip'}";
|
||||
}
|
||||
|
||||
@@ -147,3 +134,25 @@ foreach $u (keys %setpass) {
|
||||
print "</pre></td></tr></table>\n";
|
||||
&ui_print_footer("", $text{'index_sharelist'});
|
||||
|
||||
# check_user_list(&uinfo, &list)
|
||||
# Checks if some user matches a username / UID list
|
||||
sub check_user_list
|
||||
{
|
||||
local ($uinfo, $skip) = @_;
|
||||
local $skipme = 0;
|
||||
foreach my $s (@$skip) {
|
||||
if ($s eq $uinfo->[0]) { $skipme++; }
|
||||
elsif ($s =~ /^(\d+)$/ && $s == $uinfo->[2]) { $skipme++; }
|
||||
elsif ($s =~ /^(\d+)\-(\d+)$/ &&
|
||||
$uinfo->[2] >= $1 && $uinfo->[2] <= $2) { $skipme++; }
|
||||
elsif ($s =~ /^(\d+)\-$/ && $uinfo->[2] >= $1) { $skipme++; }
|
||||
elsif ($s =~ /^\-(\d+)$/ && $uinfo->[2] <= $1) { $skipme++; }
|
||||
elsif ($s =~ /^\@(.*)$/) {
|
||||
local @ginfo = getgrnam($1);
|
||||
local @mems = split(/\s+/, $ginfo[3]);
|
||||
$skipme++ if ($uinfo->[3] == $ginfo[2] ||
|
||||
&indexof($uinfo->[0], @mems) >= 0);
|
||||
}
|
||||
}
|
||||
return $skipme;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user