Clone user UI

This commit is contained in:
Jamie Cameron
2016-05-25 19:15:40 +02:00
parent 004c9194f3
commit 262bbd3e03
3 changed files with 21 additions and 2 deletions

View File

@@ -7,13 +7,22 @@ use Time::Local;
&ReadParse();
# Show header and get the user
@ulist = &list_users();
$n = $in{'user'};
if ($n eq "") {
if ($n eq '') {
# Creating a new user
$access{'ucreate'} || &error($text{'uedit_ecreate'});
&ui_print_header(undef, $text{'uedit_title2'}, "", "create_user");
if ($in{'clone'} ne '') {
($clone_hash) = grep { $_->{'user'} eq $in{'clone'} } @ulist;
$clone_hash || &error($text{'uedit_egone'});
%uinfo = %$clone_hash;
&can_edit_user(\%access, \%uinfo) || &error($text{'uedit_eedit'});
$uinfo{'user'} = '';
}
}
else {
@ulist = &list_users();
# Editing an existing one
($uinfo_hash) = grep { $_->{'user'} eq $n } @ulist;
$uinfo_hash || &error($text{'uedit_egone'});
%uinfo = %$uinfo_hash;
@@ -597,6 +606,11 @@ if ($n ne "") {
}
}
# Clone user
if ($access{'ucreate'}) {
push(@buts, [ "clone", $text{'edit_clone'} ]);
}
# Delete user
if ($access{'udelete'}) {
push(@buts, [ "delete", $text{'delete'} ]);

View File

@@ -134,6 +134,7 @@ uedit_uid_def=Automatic
uedit_uid_calc=Calculated
uedit_disabled=Login temporarily disabled
uedit_sys=System default
uedit_clone=Clone User
usave_err=Failed to save user
usave_eedit=You cannot edit this user

View File

@@ -25,6 +25,10 @@ elsif ($in{'delete'}) {
&redirect("delete_user.cgi?user=".&urlize($in{'old'}));
return;
}
elsif ($in{'clone'}) {
&redirect("edit_user.cgi?clone=".&urlize($in{'old'}));
return;
}
# Build list of used UIDs and GIDs
&build_user_used(\%used);