Allow to create a user for a specific backend
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
5b5c3a1773
commit
9e6ac3de70
|
@ -38,6 +38,7 @@ use OCP\IUser;
|
|||
use OCP\IUserBackend;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IConfig;
|
||||
use OCP\UserInterface;
|
||||
|
||||
/**
|
||||
* Class Manager
|
||||
|
@ -321,9 +322,26 @@ 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)
|
||||
*
|
||||
|
|
|
@ -129,6 +129,15 @@ interface IUserManager {
|
|||
*/
|
||||
public function createUser($uid, $password);
|
||||
|
||||
/**
|
||||
* @param string $uid
|
||||
* @param string $password
|
||||
* @param UserInterface $backend
|
||||
* @return IUser|null
|
||||
* @since 12.0.0
|
||||
*/
|
||||
public function createUserFromBackend($uid, $password, UserInterface $backend);
|
||||
|
||||
/**
|
||||
* returns how many users per backend exist (if supported by backend)
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue