Fixed copying of .acl files when cloning a user

This commit is contained in:
Jamie Cameron
2007-11-23 23:26:43 +00:00
parent 075c64960d
commit 6f7eab4a13
3 changed files with 15 additions and 4 deletions

View File

@ -37,3 +37,5 @@ Re-designed the Edit User page to use the new Webmin UI library, and move lesser
Webmin users can have a real name, which can be any text you like. Webmin users can have a real name, which can be any text you like.
---- Changes since 1.370 ---- ---- Changes since 1.370 ----
When editing a user who inherits some modules and ACL settings from a group, they can no longer be de-selected or edited. When editing a user who inherits some modules and ACL settings from a group, they can no longer be de-selected or edited.
---- Changes since 1.380 ----
Fixed a bug that prevented cloning from copying detailed access control settings, and ensured that other user attributes like the group, theme, language and access times are cloned too.

View File

@ -25,8 +25,9 @@ else {
&ui_print_header(undef, $text{'edit_title2'}, ""); &ui_print_header(undef, $text{'edit_title2'}, "");
foreach $u (&list_users()) { foreach $u (&list_users()) {
if ($u->{'name'} eq $in{'clone'}) { if ($u->{'name'} eq $in{'clone'}) {
$user{'modules'} = $u->{'modules'}; # Initial settings come from clone
$user{'lang'} = $u->{'lang'}; %user = %$u;
delete($user{'name'});
} }
if ($u->{'name'} eq $base_remote_user) { if ($u->{'name'} eq $base_remote_user) {
$me = $u; $me = $u;
@ -50,7 +51,7 @@ if ($in{'user'}) {
print &ui_hidden("oldpass", $user{'pass'}); print &ui_hidden("oldpass", $user{'pass'});
} }
if ($in{'clone'}) { if ($in{'clone'}) {
print &ui_hidden("clone", $user{'clone'}); print &ui_hidden("clone", $in{'clone'});
} }
print &ui_hidden_table_start($text{'edit_rights'}, "width=100%", 2, "rights", print &ui_hidden_table_start($text{'edit_rights'}, "width=100%", 2, "rights",
1, [ "width=30%" ]); 1, [ "width=30%" ]);
@ -60,6 +61,11 @@ print &ui_table_row($text{'edit_user'},
$access{'rename'} || !$in{'user'} ? $access{'rename'} || !$in{'user'} ?
&ui_textbox("name", $user{'name'}, 30) : $user{'name'}); &ui_textbox("name", $user{'name'}, 30) : $user{'name'});
# Source user for clone
if ($in{'clone'}) {
print &ui_table_row($text{'edit_cloneof'}, "<tt>$in{'clone'}</tt>");
}
# Find and show parent group # Find and show parent group
@glist = &list_groups(); @glist = &list_groups();
@mcan = $access{'gassign'} eq '*' ? @mcan = $access{'gassign'} eq '*' ?
@ -73,7 +79,9 @@ if (@glist && %gcan && !$in{'risk'} && !$user{'risk'}) {
} }
$memg = undef; $memg = undef;
foreach $g (@glist) { foreach $g (@glist) {
if (&indexof($user{'name'}, @{$g->{'members'}}) >= 0) { if (&indexof($user{'name'}, @{$g->{'members'}}) >= 0 ||
$in{'clone'} &&
&indexof($in{'clone'}, @{$g->{'members'}}) >= 0) {
$memg = $g; $memg = $g;
} }
next if (!$gcan{$g->{'name'}} && $memg ne $g); next if (!$gcan{$g->{'name'}} && $memg ne $g);

View File

@ -29,6 +29,7 @@ edit_title2=Create Webmin User
edit_readonly=This Webmin user should not be edited as it is managed by the $1 module. <a href='$2'>Click here</a> to bypass this warning and edit the user anyway - but beware that any manual changes may be over-written! edit_readonly=This Webmin user should not be edited as it is managed by the $1 module. <a href='$2'>Click here</a> to bypass this warning and edit the user anyway - but beware that any manual changes may be over-written!
edit_rights=Webmin user access rights edit_rights=Webmin user access rights
edit_user=Username edit_user=Username
edit_cloneof=Cloning Webmin user
edit_real=Real name edit_real=Real name
edit_group=Member of group edit_group=Member of group
edit_pass=Password edit_pass=Password