diff options
Diffstat (limited to 'lib/private/User/Manager.php')
-rw-r--r-- | lib/private/User/Manager.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index 6220613cbb1..d482ee811f7 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -38,6 +38,7 @@ use OCP\IUser; use OCP\IUserBackend; use OCP\IUserManager; use OCP\IConfig; +use OCP\UserInterface; /** * Class Manager @@ -321,10 +322,27 @@ class Manager extends PublicEmitter implements IUserManager { return $user; } } + return false; } /** + * @param string $uid + * @param string $password + * @param UserInterface $backend + * @return IUser|null + */ + public function createUserFromBackend($uid, $password, UserInterface $backend) { + $this->emit('\OC\User', 'preCreateUser', [$uid, $password]); + $backend->createUser($uid, $password); + $user = $this->getUserObject($uid, $backend); + if ($user instanceof IUser) { + $this->emit('\OC\User', 'postCreateUser', [$user, $password]); + } + return $user; + } + + /** * returns how many users per backend exist (if supported by backend) * * @param boolean $hasLoggedIn when true only users that have a lastLogin |