summaryrefslogtreecommitdiffstats
path: root/lib/private/Collaboration/Collaborators/RemotePlugin.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-10-17 21:20:15 +0200
committerJulius Härtl <jus@bitgrid.net>2018-10-30 10:19:33 +0100
commitce79e587e471493a40f08790f7c9e58f80452198 (patch)
tree77f5483ccc3af6a64a38c44e0bfc5af27ccdb06f /lib/private/Collaboration/Collaborators/RemotePlugin.php
parent45d8aeb9f2708cc53473d8a344a1a8fe6a0331bc (diff)
downloadnextcloud-server-ce79e587e471493a40f08790f7c9e58f80452198.tar.gz
nextcloud-server-ce79e587e471493a40f08790f7c9e58f80452198.zip
Filter out local users from address book remote searches
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/Collaboration/Collaborators/RemotePlugin.php')
-rw-r--r--lib/private/Collaboration/Collaborators/RemotePlugin.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/private/Collaboration/Collaborators/RemotePlugin.php b/lib/private/Collaboration/Collaborators/RemotePlugin.php
index e0f5298f83b..c967b51df14 100644
--- a/lib/private/Collaboration/Collaborators/RemotePlugin.php
+++ b/lib/private/Collaboration/Collaborators/RemotePlugin.php
@@ -30,6 +30,7 @@ use OCP\Collaboration\Collaborators\SearchResultType;
use OCP\Contacts\IManager;
use OCP\Federation\ICloudIdManager;
use OCP\IConfig;
+use OCP\IUserManager;
use OCP\Share;
class RemotePlugin implements ISearchPlugin {
@@ -41,11 +42,14 @@ class RemotePlugin implements ISearchPlugin {
private $cloudIdManager;
/** @var IConfig */
private $config;
+ /** @var IUserManager */
+ private $userManager;
- public function __construct(IManager $contactsManager, ICloudIdManager $cloudIdManager, IConfig $config) {
+ public function __construct(IManager $contactsManager, ICloudIdManager $cloudIdManager, IConfig $config, IUserManager $userManager) {
$this->contactsManager = $contactsManager;
$this->cloudIdManager = $cloudIdManager;
$this->config = $config;
+ $this->userManager = $userManager;
$this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes';
}
@@ -69,11 +73,16 @@ class RemotePlugin implements ISearchPlugin {
$lowerSearch = strtolower($search);
foreach ($cloudIds as $cloudId) {
try {
- list(, $serverUrl) = $this->splitUserRemote($cloudId);
+ list($remoteUser, $serverUrl) = $this->splitUserRemote($cloudId);
} catch (\InvalidArgumentException $e) {
continue;
}
+ $localUser = $this->userManager->get($remoteUser);
+ if ($localUser !== null && $cloudId === $localUser->getCloudId()) {
+ continue;
+ }
+
if (strtolower($contact['FN']) === $lowerSearch || strtolower($cloudId) === $lowerSearch) {
if (strtolower($cloudId) === $lowerSearch) {
$searchResult->markExactIdMatch($resultType);