diff options
author | FGIKCM <FGIKCM@users.noreply.github.com> | 2018-06-18 17:21:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-18 17:21:28 +0300 |
commit | ce6e825b0f3feb382d9ea5a92c965809dbbbfe47 (patch) | |
tree | 416f2f12ad13630730640ee432815e69306cd869 /lib/UserBackend.php | |
parent | 3002bbfaaa4568b92a932e89e0ef935817c97022 (diff) |
Create skeleton and dispatch first login event
Code taken from 'regular' login method do create skeleton and dispatch event of the user creation.
A better idea would be to directly use the `prepareUserLogin()` method of `lib/private/User/Session.php`, but as it is private...
Diffstat (limited to 'lib/UserBackend.php')
-rw-r--r-- | lib/UserBackend.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/UserBackend.php b/lib/UserBackend.php index 17e437ae..fd5df33f 100644 --- a/lib/UserBackend.php +++ b/lib/UserBackend.php @@ -31,6 +31,7 @@ use OCP\IUserBackend; use OCP\IConfig; use OCP\IURLGenerator; use OCP\ISession; +use Symfony\Component\EventDispatcher\GenericEvent; class UserBackend implements IApacheBackend, UserInterface, IUserBackend { /** @var IConfig */ @@ -108,6 +109,19 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend { $qb->setValue($column, $qb->createNamedParameter($value)); } $qb->execute(); + + ### Code taken from lib/private/User/Session.php - function prepareUserLogin() ### + //trigger creation of user home and /files folder + $userFolder = \OC::$server->getUserFolder($uid); + try { + // copy skeleton + \OC_Util::copySkeleton($uid, $userFolder); + } catch (NotPermittedException $ex) { + // read only uses + } + // trigger any other initialization + $user = $this->userManager->get($uid); + \OC::$server->getEventDispatcher()->dispatch(IUser::class . '::firstLogin', new GenericEvent($user)); } } |