aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/legacy/OC_User.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/legacy/OC_User.php')
-rw-r--r--lib/private/legacy/OC_User.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php
index 3d958814988..51bf0fd6049 100644
--- a/lib/private/legacy/OC_User.php
+++ b/lib/private/legacy/OC_User.php
@@ -41,6 +41,7 @@ use OCP\EventDispatcher\IEventDispatcher;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
+use OCP\IUserSession;
use OCP\Server;
use OCP\User\Events\BeforeUserLoggedInEvent;
use OCP\User\Events\UserLoggedInEvent;
@@ -349,7 +350,7 @@ class OC_User {
* @return string|false uid or false
*/
public static function getUser() {
- $uid = \OC::$server->getSession() ? \OC::$server->getSession()->get('user_id') : null;
+ $uid = Server::get(IUserSession::class)->getUser()?->getUID();
if (!is_null($uid) && self::$incognitoMode === false) {
return $uid;
} else {