From 5a73a9b9ded91b15ca044d27ac2cf42fb483af93 Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Tue, 30 Oct 2018 11:41:56 +0100 Subject: Fix injection to get the user id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Collaboration/Collaborators/RemotePlugin.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/private/Collaboration/Collaborators/RemotePlugin.php b/lib/private/Collaboration/Collaborators/RemotePlugin.php index 0eab02ab0fa..d877346b155 100644 --- a/lib/private/Collaboration/Collaborators/RemotePlugin.php +++ b/lib/private/Collaboration/Collaborators/RemotePlugin.php @@ -31,6 +31,7 @@ use OCP\Contacts\IManager; use OCP\Federation\ICloudIdManager; use OCP\IConfig; use OCP\IUserManager; +use OCP\IUserSession; use OCP\Share; class RemotePlugin implements ISearchPlugin { @@ -45,15 +46,17 @@ class RemotePlugin implements ISearchPlugin { /** @var IUserManager */ private $userManager; /** @var string */ - private $userId; + private $userId = ''; - public function __construct(IManager $contactsManager, ICloudIdManager $cloudIdManager, IConfig $config, IUserManager $userManager, $userId) { + public function __construct(IManager $contactsManager, ICloudIdManager $cloudIdManager, IConfig $config, IUserManager $userManager, IUserSession $userSession) { $this->contactsManager = $contactsManager; $this->cloudIdManager = $cloudIdManager; $this->config = $config; $this->userManager = $userManager; - $this->userId = $userId; - + $user = $userSession->getUser(); + if ($user !== null) { + $this->userId = $user->getUID(); + } $this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; } -- cgit v1.2.3