From 6af07f6f8d0c4004e40e5603ce291ced603176fd Mon Sep 17 00:00:00 2001 From: Ricki Hirner Date: Mon, 1 Jul 2024 22:22:41 +0200 Subject: [PATCH] Fix getUser (#5) --- lib/Dav/SubscriptionManagementPlugin.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Dav/SubscriptionManagementPlugin.php b/lib/Dav/SubscriptionManagementPlugin.php index de5074e..f4fd3b4 100644 --- a/lib/Dav/SubscriptionManagementPlugin.php +++ b/lib/Dav/SubscriptionManagementPlugin.php @@ -60,8 +60,7 @@ class SubscriptionManagementPlugin extends ServerPlugin { private IUserSession $userSession, private TransportManager $transportManager, private IURLGenerator $URLGenerator, - private SubscriptionService $subscriptionService, - private $userId, + private SubscriptionService $subscriptionService ) { } @@ -150,7 +149,8 @@ class SubscriptionManagementPlugin extends ServerPlugin { $response->setStatus($responseStatus); // create subscription entry in db - $subscription = $this->subscriptionService->create($this->userId, $node->getName(), $subscriptionType, $subscriptionExpires, $data); + $user = $this->userSession->getUser(); + $subscription = $this->subscriptionService->create($user->getUID(), $node->getName(), $subscriptionType, $subscriptionExpires, $data); // generate default unsubscribe link, unless transport requested a custom url $unsubscribeLink = $unsubscribeLink ?? $this->URLGenerator->getAbsoluteURL("/apps/dav_push/subscriptions/" . $subscription->getId());