From 4fbf19167827c432683fbc7e0c1409210572352e Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Wed, 1 Jul 2020 12:43:23 -0100 Subject: [PATCH] use UserSession for dav conn Signed-off-by: Maxence Lange --- lib/Service/CirclesService.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Service/CirclesService.php b/lib/Service/CirclesService.php index c63c45ed4..de369deaf 100644 --- a/lib/Service/CirclesService.php +++ b/lib/Service/CirclesService.php @@ -49,6 +49,7 @@ use OCA\Circles\Model\Member; use OCP\IGroupManager; use OCP\IL10N; +use OCP\IUserSession; class CirclesService { @@ -91,6 +92,7 @@ class CirclesService { * * @param string $userId * @param IL10N $l10n + * @param IUserSession $userSession * @param IGroupManager $groupManager * @param ConfigService $configService * @param CirclesRequest $circlesRequest @@ -104,6 +106,7 @@ class CirclesService { public function __construct( $userId, IL10N $l10n, + IUserSession $userSession, IGroupManager $groupManager, ConfigService $configService, CirclesRequest $circlesRequest, @@ -114,6 +117,14 @@ public function __construct( CircleProviderRequest $circleProviderRequest, MiscService $miscService ) { + + if ($userId === null) { + $user = $userSession->getUser(); + if ($user !== null) { + $userId = $user->getUID(); + } + } + $this->userId = $userId; $this->l10n = $l10n; $this->groupManager = $groupManager;