Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/user_saml.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2019-01-24 16:58:11 +0300
committerGitHub <noreply@github.com>2019-01-24 16:58:11 +0300
commit577f612267f95d3204247e4cfe743a8e47b0600f (patch)
tree109c24e8f8d769ef590e340849a071b800d77c87 /lib
parent9b98504c6f0d13dc395b3fc2dfe38872e8c0dbf2 (diff)
parentec593bce13db99d5f1770a6f5673ed66901af911 (diff)
Merge pull request #286 from nextcloud/fix-268
always create user in the SAML back-end and update the attributes
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/SAMLController.php5
-rw-r--r--lib/UserBackend.php35
2 files changed, 26 insertions, 14 deletions
diff --git a/lib/Controller/SAMLController.php b/lib/Controller/SAMLController.php
index 902199a4..8f508b22 100644
--- a/lib/Controller/SAMLController.php
+++ b/lib/Controller/SAMLController.php
@@ -284,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'));
diff --git a/lib/UserBackend.php b/lib/UserBackend.php
index 026c275a..bc8d9f3f 100644
--- a/lib/UserBackend.php
+++ b/lib/UserBackend.php
@@ -146,19 +146,28 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
}
$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));
+ $this->initializeHomeDir($uid);
+
+ }
+ }
+
+ /**
+ * @param string $uid
+ * @throws \OCP\Files\NotFoundException
+ */
+ public function initializeHomeDir($uid) {
+ ### 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));
}
/**
@@ -227,7 +236,7 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
/**
* Returns the user's home directory, if home directory mapping is set up.
*
- * @param string $uid the username
+ * @param string $uid the username
* @return string
*/
public function getHome($uid) {