From ec593bce13db99d5f1770a6f5673ed66901af911 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 22 Jan 2019 13:38:56 +0100 Subject: [PATCH] user might be already known, but was not mapped yet. init on first login. Signed-off-by: Arthur Schiwon --- lib/Controller/SAMLController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Controller/SAMLController.php b/lib/Controller/SAMLController.php index d3d4598..97205ae 100644 --- a/lib/Controller/SAMLController.php +++ b/lib/Controller/SAMLController.php @@ -144,7 +144,6 @@ class SAMLController extends Controller { // help with it and make the user known $this->userManager->search($uid); if($this->userManager->userExists($uid)) { - $this->userBackend->initializeHomeDir($uid); return; } throw new NoUserFoundException('Auto provisioning not allowed and user ' . $uid . ' does not exist'); @@ -285,7 +284,10 @@ class SAMLController extends Controller { if (!($user instanceof IUser)) { throw new \InvalidArgumentException('User is not valid'); } - $user->updateLastLoginTimestamp(); + $firstLogin = $user->updateLastLoginTimestamp(); + if($firstLogin) { + $this->userBackend->initializeHomeDir($user->getUID()); + } } catch (\Exception $e) { $this->logger->logException($e, ['app' => $this->appName]); return new Http\RedirectResponse($this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.notProvisioned'));