diff --git a/useradmin/CHANGELOG b/useradmin/CHANGELOG index f6d7ff1bc..a56db5211 100644 --- a/useradmin/CHANGELOG +++ b/useradmin/CHANGELOG @@ -37,3 +37,4 @@ In a user batch file, # is only treated as a comment at the start of a line. The real base directory for homes is now respected when batch creating users. Improved MD5 encryption auto-detection with newer PAM config files. Batch user creation data is now better validated, and the batch form has been re-written to use the new Webmin UI library. +When renaming a user whose group is the same as his username, the group will be renamed too by default. diff --git a/useradmin/edit_user.cgi b/useradmin/edit_user.cgi index 256a6a948..cb35013ad 100755 --- a/useradmin/edit_user.cgi +++ b/useradmin/edit_user.cgi @@ -463,7 +463,7 @@ if ($n eq "" && $access{'gcreate'}) { $config{'new_user_group'} ? 'checked' : '', $text{'uedit_samg'}; printf " %s\n", $text{'uedit_newg'}; - print "
\n"; + print "
\n"; printf " %s\n", $config{'new_user_group'} ? '' : 'checked', $text{'uedit_oldg'}; } @@ -473,7 +473,7 @@ if ($access{'ugroups'} eq "*" || $access{'uedit_gmode'} >= 3) { if ($gconfig{'db_sizeuser'}) { ($w, $h) = split(/x/, $gconfig{'db_sizeuser'}); } - printf "\n", + printf "\n", $n eq "" ? $config{'default_group'} : scalar(&my_getgrgid($uinfo{'gid'})); print "\n"; @@ -543,43 +543,57 @@ if ($n ne "") { # and updating in other modules if ($access{'movehome'} == 1 || $access{'chuid'} == 1 || $access{'chgid'} == 1 || $access{'mothers'} == 1) { - print "\n"; - print "\n"; - print "
$text{'onsave'}
\n"; + print &ui_table_start($text{'onsave'}, "width=100%", 2, + [ "width=30%" ]); + # Move home directory if ($access{'movehome'} == 1) { - print "\n"; - print "\n"; - print "\n"; + print &ui_table_row( + &hlink($text{'uedit_movehome'}, "movehome"), + &ui_yesno_radio("movehome", 1)); } + # Change UID on files if ($access{'chuid'} == 1) { - print "\n"; - print "\n"; - print "\n"; - print "\n"; + print &ui_table_row( + &hlink($text{'uedit_chuid'},"chuid"), + &ui_radio("chuid", 1, + [ [ 0, $text{'no'} ], + [ 1, $text{'home'} ], + [ 2, $text{'uedit_allfiles'} ] ])); } + # Change GID on files if ($access{'chgid'} == 1) { - print "\n"; - print "\n"; - print "\n"; - print "\n"; + print &ui_table_row( + &hlink($text{'uedit_chgid'},"chgid"), + &ui_radio("chgid", 1, + [ [ 0, $text{'no'} ], + [ 1, $text{'home'} ], + [ 2, $text{'uedit_allfiles'} ] ])); } + # Modify in other modules if ($access{'mothers'} == 1) { - print "\n"; - printf "\n", - $config{'default_other'} ? "checked" : ""; - printf "\n", - $config{'default_other'} ? "" : "checked"; + print &ui_table_row( + &hlink($text{'uedit_mothers'},"others"), + &ui_yesno_radio("others", + $config{'default_other'} ? 1 : 0)); } - print "
",&hlink($text{'uedit_movehome'}, "movehome")," $text{'yes'} $text{'no'}
",&hlink($text{'uedit_chuid'},"chuid")," $text{'no'} ", - "$text{'home'} ", - "$text{'uedit_allfiles'}
",&hlink($text{'chgid'},"chgid")," $text{'no'} ". - "$text{'home'} ", - "$text{'uedit_allfiles'}
",&hlink($text{'uedit_mothers'},"others")," $text{'yes'} $text{'no'}

\n"; + # Rename group, if the same and if editable + @ginfo = &my_getgrgid($uinfo{'gid'}); + if ($ginfo[0] eq $uinfo{'user'}) { + ($group) = grep { $_->{'gid'} == $uinfo{'gid'} } + &list_groups(); + if (&can_edit_group(\%access, $group)) { + print &ui_table_row( + &hlink($text{'uedit_grename'},"grename"), + &ui_yesno_radio("grename", 1)); + } + } + + print &ui_table_end(),"

\n"; } } else { diff --git a/useradmin/help/grename.html b/useradmin/help/grename.html new file mode 100644 index 000000000..ca9db4a87 --- /dev/null +++ b/useradmin/help/grename.html @@ -0,0 +1,9 @@ +

Rename group if username changes?
+ +When editing a user whose primary group is the same as his username, this +option can be used to rename the group if the user's name is changed. This +is recommended for consistency's sake, but may break other configuration files +that contain the old group name. + +