Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/UserBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ public function createUserIfNotExists(string $uid, array $attributes = []): void
* @throws \OCP\Files\NotFoundException
*/
public function initializeHomeDir(string $uid): void {
$user = $this->userManager->get($uid);
if ($user === null) {
throw new \LogicException('Trying to initialize home dir for a non-existent user');
}

if (version_compare($this->config->getSystemValueString('version', '0.0.0'), '34.0.0', '>=')) {
$this->eventDispatcher->dispatchTyped(new UserFirstTimeLoggedInEvent($user));
return;
}

### Code taken from lib/private/User/Session.php - function prepareUserLogin() ###
//trigger creation of user home and /files folder
$userFolder = Server::get(IRootFolder::class)->getUserFolder($uid);
Expand All @@ -130,10 +140,6 @@ public function initializeHomeDir(string $uid): void {
// read only uses
}
// trigger any other initialization
$user = $this->userManager->get($uid);
if ($user === null) {
throw new \LogicException('Trying to initialize home dir for a non-existent user');
}
$this->eventDispatcher->dispatchTyped(new UserFirstTimeLoggedInEvent($user));
}

Expand Down
Loading