Merge pull request #23901 from nextcloud/techdebt/noid/deprecate-old-usermanager-events

Deprecate old user manager events for user creation
This commit is contained in:
Roeland Jago Douma 2020-11-05 09:37:07 +01:00 committed by GitHub
commit 12e2b74872
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -365,6 +365,7 @@ class Manager extends PublicEmitter implements IUserManager {
throw new \InvalidArgumentException($l->t('The username is already being used'));
}
/** @depreacted 21.0.0 use CreateUserEvent event with the IEventDispatcher instead */
$this->emit('\OC\User', 'preCreateUser', [$uid, $password]);
$this->eventDispatcher->dispatchTyped(new CreateUserEvent($uid, $password));
$state = $backend->createUser($uid, $password);
@ -373,6 +374,7 @@ class Manager extends PublicEmitter implements IUserManager {
}
$user = $this->getUserObject($uid, $backend);
if ($user instanceof IUser) {
/** @depreacted 21.0.0 use UserCreatedEvent event with the IEventDispatcher instead */
$this->emit('\OC\User', 'postCreateUser', [$user, $password]);
$this->eventDispatcher->dispatchTyped(new UserCreatedEvent($user, $password));
}