mirror of
https://github.com/netzbegruenung/user_saml.git
synced 2024-05-03 09:33:46 +02:00
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>
This commit is contained in:
parent
b76a69400c
commit
0b0bfe94a2
|
@ -144,6 +144,7 @@ class SAMLController extends Controller {
|
||||||
// help with it and make the user known
|
// help with it and make the user known
|
||||||
$this->userManager->search($uid);
|
$this->userManager->search($uid);
|
||||||
if($this->userManager->userExists($uid)) {
|
if($this->userManager->userExists($uid)) {
|
||||||
|
$this->userBackend->initializeHomeDir($uid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new NoUserFoundException('Auto provisioning not allowed and user ' . $uid . ' does not exist');
|
throw new NoUserFoundException('Auto provisioning not allowed and user ' . $uid . ' does not exist');
|
||||||
|
|
|
@ -146,21 +146,30 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
||||||
}
|
}
|
||||||
$qb->execute();
|
$qb->execute();
|
||||||
|
|
||||||
### Code taken from lib/private/User/Session.php - function prepareUserLogin() ###
|
$this->initializeHomeDir($uid);
|
||||||
//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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if backend implements actions
|
* Check if backend implements actions
|
||||||
* @param int $actions bitwise-or'ed actions
|
* @param int $actions bitwise-or'ed actions
|
||||||
|
@ -227,7 +236,7 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
||||||
/**
|
/**
|
||||||
* Returns the user's home directory, if home directory mapping is set up.
|
* 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
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getHome($uid) {
|
public function getHome($uid) {
|
||||||
|
|
Loading…
Reference in a new issue