diff options
author | Tom Needham <needham.thomas@gmail.com> | 2012-04-07 22:00:32 +0000 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2012-04-07 22:00:32 +0000 |
commit | 5e314e8effb42b60d720de40fbf74591ae421534 (patch) | |
tree | 07bb999426ed8ea31b36d51fbb39b22eea6c7404 /lib/migrate.php | |
parent | c0869887cf91bf17421a9163069584d29ec5ed49 (diff) | |
download | nextcloud-server-5e314e8effb42b60d720de40fbf74591ae421534.tar.gz nextcloud-server-5e314e8effb42b60d720de40fbf74591ae421534.zip |
Emit hooks for user creation
Diffstat (limited to 'lib/migrate.php')
-rw-r--r-- | lib/migrate.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/migrate.php b/lib/migrate.php index 6734c805fcf..2730d26a74a 100644 --- a/lib/migrate.php +++ b/lib/migrate.php @@ -232,10 +232,19 @@ class OC_Migrate{ OC_Log::write( 'migration', 'User already exists', OC_Log::ERROR ); return json_encode( array( 'success' => false ) ); } + $run = true; + OC_Hook::emit( "OC_User", "pre_createUser", array( "run" => &$run, "uid" => self::$uid, "password" => $json->hash )); + if( !$run ){ + // Something stopped the user creation + OC_Log::write( 'migration', 'User creation failed', OC_Log::ERROR ); + return json_encode( array( 'success' => false ) ); + } // Create the user if( !self::createUser( self::$uid, $json->hash ) ){ return json_encode( array( 'success' => false ) ); } + // Emit the post_createUser hook (password is already hashed, will cause problems + OC_Hook::emit( "OC_User", "post_createUser", array( "uid" => self::$uid, "password" => $json->hash )); // Make the new users data dir $path = $datadir . '/' . self::$uid . '/files/'; if( !mkdir( $path, 0755, true ) ){ |