mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 01:00:50 -04:00
Merge pull request #54109 from nextcloud/backport/53909/stable30
This commit is contained in:
commit
b0953333be
2 changed files with 13 additions and 4 deletions
|
|
@ -536,10 +536,16 @@ class UsersController extends AUserData {
|
|||
throw new OCSException($this->l10n->t('Required email address was not provided'), 110);
|
||||
}
|
||||
|
||||
// Create the user
|
||||
try {
|
||||
$newUser = $this->userManager->createUser($userid, $password);
|
||||
$this->logger->info('Successful addUser call with userid: ' . $userid, ['app' => 'ocs_api']);
|
||||
if (!$newUser instanceof IUser) {
|
||||
// If the user is not an instance of IUser, it means the user creation failed
|
||||
$this->logger->error('Failed addUser attempt: User creation failed.', ['app' => 'ocs_api']);
|
||||
throw new OCSException($this->l10n->t('User creation failed'), 111);
|
||||
}
|
||||
|
||||
$this->logger->info('Successful addUser call with userid: ' . $userid, ['app' => 'ocs_api']);
|
||||
foreach ($groups as $group) {
|
||||
$this->groupManager->get($group)->addUser($newUser);
|
||||
$this->logger->info('Added userid ' . $userid . ' to group ' . $group, ['app' => 'ocs_api']);
|
||||
|
|
|
|||
|
|
@ -466,7 +466,8 @@ class UsersControllerTest extends TestCase {
|
|||
$this->userManager
|
||||
->expects($this->once())
|
||||
->method('createUser')
|
||||
->with('NewUser', 'PasswordOfTheNewUser');
|
||||
->with('NewUser', 'PasswordOfTheNewUser')
|
||||
->willReturn($this->createMock(IUser::class));
|
||||
$this->logger
|
||||
->expects($this->once())
|
||||
->method('info')
|
||||
|
|
@ -529,7 +530,8 @@ class UsersControllerTest extends TestCase {
|
|||
$this->userManager
|
||||
->expects($this->once())
|
||||
->method('createUser')
|
||||
->with('NewUser', 'PasswordOfTheNewUser');
|
||||
->with('NewUser', 'PasswordOfTheNewUser')
|
||||
->willReturn($this->createMock(IUser::class));
|
||||
$this->logger
|
||||
->expects($this->once())
|
||||
->method('info')
|
||||
|
|
@ -579,7 +581,8 @@ class UsersControllerTest extends TestCase {
|
|||
$this->userManager
|
||||
->expects($this->once())
|
||||
->method('createUser')
|
||||
->with($this->anything(), 'PasswordOfTheNewUser');
|
||||
->with($this->anything(), 'PasswordOfTheNewUser')
|
||||
->willReturn($this->createMock(IUser::class));
|
||||
$this->logger
|
||||
->expects($this->once())
|
||||
->method('info')
|
||||
|
|
|
|||
Loading…
Reference in a new issue