[vhffs-dev] [444] Finished the function to delete users homes

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 444
Author:   gradator
Date:     2007-02-10 17:36:21 +0000 (Sat, 10 Feb 2007)

Log Message:
-----------
Finished the function to delete users homes

Modified Paths:
--------------
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Constants.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/User.pm
    branches/vhffs_4.1/vhffs-panel/user/delete.pl
    trunk/vhffs-api/src/Vhffs/Robots/User.pm


Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Constants.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Constants.pm	2007-02-08 16:21:21 UTC (rev 443)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Constants.pm	2007-02-10 17:36:21 UTC (rev 444)
@@ -7,7 +7,7 @@
 
 use constant
 {
-    VHFFS_VERSION => '4.1-alpha (Revision: 429)',
+    VHFFS_VERSION => '4.1-alpha (Revision: 443)',
     VHFFS_RELEASE_NAME => "hippocampus",
     
     WAITING_FOR_VALIDATION => 1,

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/User.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/User.pm	2007-02-08 16:21:21 UTC (rev 443)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Robots/User.pm	2007-02-10 17:36:21 UTC (rev 444)
@@ -60,31 +60,20 @@
 	
 	if( defined $user )
 	{
-		$user->add_history( "Ok, robots take now the deletion of the user" );
+		$user->add_history( "Ok, robots takes now the destruction of this user" );
 		$homedir = $user->get_home;
 
-		@subdirs = split( /\// , $homedir );
-		@subdirs = reverse @subdirs;
-		
-		$path = "";
-		
-		while( defined ( $value = pop ( @subdirs ) )  )
+		if( $homedir && -d $homedir )
 		{
-			$path .= "/".$value if( $value ne '' );
-			Vhffs::Functions::create_dir( $path );
-			#return -1 if( mkdir( $path ) == false );
-		}
-		chown $user->get_uid , $user->get_gid , $path ;
-		
-		$user->add_history( "Creation complete for user. Homedir is now created." );
-		$user->set_status( Vhffs::Constants::ACTIVATED );
-		my $plainpassword = $user->generate_password;
+			$cmd = "rm -f $homedir/*";
+			system( $cmd );
 
-		$user->commit;
+			$cmd = "rmdir $homedir";
+			system( $cmd );
+		}
 	}
 
 	return 1;
-
 }
 
 

Modified: branches/vhffs_4.1/vhffs-panel/user/delete.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/user/delete.pl	2007-02-08 16:21:21 UTC (rev 443)
+++ branches/vhffs_4.1/vhffs-panel/user/delete.pl	2007-02-10 17:36:21 UTC (rev 444)
@@ -71,7 +71,7 @@
 
 	if( $delete == 1 )
 	{
-		if( defined $user->get_groups )
+		if( $user->have_activegroups )
 		{
 			$message = gettext("This user is always in a group");
 		}

Modified: trunk/vhffs-api/src/Vhffs/Robots/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/User.pm	2007-02-08 16:21:21 UTC (rev 443)
+++ trunk/vhffs-api/src/Vhffs/Robots/User.pm	2007-02-10 17:36:21 UTC (rev 444)
@@ -80,38 +80,27 @@
 
 sub delete_home
 {
-	my( $main , $username , $user , $homedir , @subdirs , $path , $value );
+	my( $main , $user , $homedir , $cmd );
 
 	$main = shift;
 	$user = shift;
-	
+
 	if( $user->fetch > 0 )
 	{
-		$user->add_history( "Ok, robots take now the creation of the user" );
+		$user->add_history( "Ok, robots takes now the destruction of this user" );
 		$homedir = $user->get_home;
 
-		@subdirs = split( /\// , $homedir );
-		@subdirs = reverse @subdirs;
-		
-		$path = "";
-		
-		while( defined ( $value = pop ( @subdirs ) )  )
+		if( $homedir && -d $homedir )
 		{
-			$path .= "/".$value if( $value ne '' );
-			Vhffs::Functions::create_dir( $path );
-			#return -1 if( mkdir( $path ) == false );
-		}
-		chown $user->get_uid , $user->get_gid , $path ;
-		
-		$user->add_history( "Creation complete for user. Homedir is now created." );
-		$user->set_status( Vhffs::Constants::ACTIVATED );
-		my $plainpassword = $user->generate_password;
+			$cmd = "rm -f $homedir/*";
+			system( $cmd );
 
-		$user->commit;
+			$cmd = "rmdir $homedir";
+			system( $cmd );
+		}
 	}
 
 	return 1;
-
 }
 
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/