[vhffs-dev] [1556] Deleting an user account as admin now really deletes the |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1556
Author: guillaumito
Date: 2010-03-12 23:43:22 +0100 (Fri, 12 Mar 2010)
Log Message:
-----------
Deleting an user account as admin now really deletes the
user account and not the admin one.
This fix bug #266
Modified Paths:
--------------
trunk/vhffs-panel/user/delete.pl
Modified: trunk/vhffs-panel/user/delete.pl
===================================================================
--- trunk/vhffs-panel/user/delete.pl 2010-03-12 22:42:28 UTC (rev 1555)
+++ trunk/vhffs-panel/user/delete.pl 2010-03-12 22:43:22 UTC (rev 1556)
@@ -65,18 +65,33 @@
my $templatedir = $vhffs->get_config->get_templatedir;
+my $userp;
+my $username = $cgi->param('name');
+if( defined $username ) {
+ $userp = Vhffs::User::get_by_username( $vhffs, $username );
+} else {
+ $userp = $user;
+}
+
#We test if the owner exist
+# We make sure the current user is allowed to delete the specified user
+if( !$user->can_delete( $userp ) )
+{
+ $message = gettext("You\'re not allowed to delete this user");
+}
+else
+{
if( $delete == 1 )
{
- if( $user->have_activegroups )
+ if( $userp->have_activegroups )
{
$message = gettext("This user is always in a group");
}
else
{
- $user->set_status( Vhffs::Constants::TO_DELETE );
- if( $user->commit < 0 )
+ $userp->set_status( Vhffs::Constants::TO_DELETE );
+ if( $userp->commit < 0 )
{
$message = gettext("An error occured while applying changes. This user will NOT be deleted");
}
@@ -91,6 +106,7 @@
$message = gettext("This user will NOT be DELETED");
}
+}
my $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );