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:
authorBjoern Schiessle <bjoern@schiessle.org>2018-12-14 20:30:38 +0300
committerBjoern Schiessle <bjoern@schiessle.org>2018-12-18 18:54:27 +0300
commit0b0bfe94a21bc5a2b317ad2549c5703425a6bc1e (patch)
treea530aac5484726e39acbb39a9ed27183d4a4fb8b /lib
parentb76a69400cb4239c9f99f45cd3ea32951b2a8a84 (diff)
create user in the SAML back-end and update the attributes when
the user was found on another back-end during login Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/SAMLController.php1
-rw-r--r--lib/UserBackend.php35
2 files changed, 23 insertions, 13 deletions
diff --git a/lib/Controller/SAMLController.php b/lib/Controller/SAMLController.php
index 9664e827..d3d4598d 100644
--- a/lib/Controller/SAMLController.php
+++ b/lib/Controller/SAMLController.php
@@ -144,6 +144,7 @@ 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');
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) {