diff --git a/lib/Controller/Id4meController.php b/lib/Controller/Id4meController.php
index 040c89895..2d3d0b624 100644
--- a/lib/Controller/Id4meController.php
+++ b/lib/Controller/Id4meController.php
@@ -44,6 +44,7 @@
use OCP\Security\ICrypto;
use OCP\Security\ISecureRandom;
+use OCP\ServerVersion;
use OCP\Util;
use Psr\Log\LoggerInterface;
@@ -71,6 +72,7 @@ public function __construct(
private ID4MeService $id4MeService,
private LoggerInterface $logger,
private ICrypto $crypto,
+ private ServerVersion $serverVersion,
) {
parent::__construct($request, $config, $l10n);
@@ -322,6 +324,6 @@ public function code(string $state = '', string $code = '', string $scope = '')
// Set last password confirm to the future as we don't have passwords to confirm against with SSO
$this->session->set('last-password-confirm', strtotime('+4 year', time()));
- return new RedirectResponse(\OC_Util::getDefaultPageUrl());
+ return new RedirectResponse($this->serverVersion->getMajorVersion() >= 32 ? $this->urlGenerator->linkToDefaultPageUrl() : \OC_Util::getDefaultPageUrl());
}
}
diff --git a/lib/Controller/LoginController.php b/lib/Controller/LoginController.php
index 90b3d51e4..4a3d1f655 100644
--- a/lib/Controller/LoginController.php
+++ b/lib/Controller/LoginController.php
@@ -58,6 +58,7 @@
use OCP\IUserSession;
use OCP\Security\ICrypto;
use OCP\Security\ISecureRandom;
+use OCP\ServerVersion;
use OCP\Session\Exceptions\SessionNotAvailableException;
use OCP\User\Events\BeforeUserLoggedInEvent;
use OCP\User\Events\UserCreatedEvent;
@@ -99,6 +100,7 @@ public function __construct(
private ICrypto $crypto,
private TokenService $tokenService,
private OidcService $oidcService,
+ private ServerVersion $serverVersion,
) {
parent::__construct($request, $config, $l10n);
}
@@ -696,7 +698,7 @@ public function code(string $state = '', string $code = '', string $scope = '',
return $this->getRedirectResponse($redirectUrl);
}
- return new RedirectResponse(\OC_Util::getDefaultPageUrl());
+ return new RedirectResponse($this->serverVersion->getMajorVersion() >= 32 ? $this->urlGenerator->linkToDefaultPageUrl() : \OC_Util::getDefaultPageUrl());
}
/**
diff --git a/lib/User/Backend.php b/lib/User/Backend.php
index 31b0317ed..63f8aae57 100644
--- a/lib/User/Backend.php
+++ b/lib/User/Backend.php
@@ -26,6 +26,8 @@
use OCP\DB\Exception;
use OCP\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\IRootFolder;
+use OCP\Files\ISetupManager;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\IConfig;
@@ -35,11 +37,13 @@
use OCP\IUser;
use OCP\IUserManager;
use OCP\Server;
+use OCP\ServerVersion;
use OCP\User\Backend\ABackend;
use OCP\User\Backend\ICountUsersBackend;
use OCP\User\Backend\ICustomLogout;
use OCP\User\Backend\IGetDisplayNameBackend;
use OCP\User\Backend\IPasswordConfirmationBackend;
+use OCP\User\Events\UserFirstTimeLoggedInEvent;
use Psr\Log\LoggerInterface;
use Throwable;
@@ -63,6 +67,7 @@ public function __construct(
private ProvisioningService $provisioningService,
private LdapService $ldapService,
private IUserManager $userManager,
+ private ServerVersion $serverVersion,
) {
}
@@ -391,9 +396,9 @@ private function checkFirstLogin(string $userId): bool {
$firstLogin = $user->getLastLogin() === 0;
if ($firstLogin) {
- \OC_Util::setupFS($userId);
+ $this->serverVersion->getMajorVersion() >= 34 ? Server::get(ISetupManager::class)->setupForUser($user) : \OC_Util::setupFS($userId);
// trigger creation of user home and /files folder
- $userFolder = \OC::$server->getUserFolder($userId);
+ $userFolder = Server::get(IRootFolder::class)->getUserFolder($userId);
try {
// copy skeleton
\OC_Util::copySkeleton($userId, $userFolder);
@@ -403,8 +408,7 @@ private function checkFirstLogin(string $userId): bool {
// trigger any other initialization
$this->eventDispatcher->dispatch(IUser::class . '::firstLogin', new GenericEvent($user));
- // TODO add this when user_oidc min NC version is >= 28
- // $this->eventDispatcher->dispatchTyped(new UserFirstTimeLoggedInEvent($user));
+ $this->eventDispatcher->dispatchTyped(new UserFirstTimeLoggedInEvent($user));
}
$user->updateLastLoginTimestamp();
return $firstLogin;
diff --git a/psalm.xml b/psalm.xml
index 41798efa8..f7ab96596 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -46,6 +46,9 @@
+
+
+
@@ -59,6 +62,7 @@
+