summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-10-17 21:21:39 +0200
committerJulius Härtl <jus@bitgrid.net>2018-10-30 10:19:33 +0100
commitd7caf841df07c1ecb39e72ac4566842b2ee5486a (patch)
tree069a47901ba8b946b321fe0421db2c5f335cf9ee /lib
parentce79e587e471493a40f08790f7c9e58f80452198 (diff)
downloadnextcloud-server-d7caf841df07c1ecb39e72ac4566842b2ee5486a.tar.gz
nextcloud-server-d7caf841df07c1ecb39e72ac4566842b2ee5486a.zip
Filter out generic remote result for local users
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Collaboration/Collaborators/RemotePlugin.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/private/Collaboration/Collaborators/RemotePlugin.php b/lib/private/Collaboration/Collaborators/RemotePlugin.php
index c967b51df14..405db986d2b 100644
--- a/lib/private/Collaboration/Collaborators/RemotePlugin.php
+++ b/lib/private/Collaboration/Collaborators/RemotePlugin.php
@@ -115,14 +115,24 @@ class RemotePlugin implements ISearchPlugin {
$result['wide'] = array_slice($result['wide'], $offset, $limit);
}
+ /**
+ * Add generic share with remote item for valid cloud ids that are not users of the local instance
+ */
if (!$searchResult->hasExactIdMatch($resultType) && $this->cloudIdManager->isValidCloudId($search) && $offset === 0) {
- $result['exact'][] = [
- 'label' => $search,
- 'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
- 'shareWith' => $search,
- ],
- ];
+ try {
+ list($remoteUser, $serverUrl) = $this->splitUserRemote($search);
+ $localUser = $this->userManager->get($remoteUser);
+ if ($localUser === null || $search !== $localUser->getCloudId()) {
+ $result['exact'][] = [
+ 'label' => $search,
+ 'value' => [
+ 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareWith' => $search,
+ ],
+ ];
+ }
+ } catch (\InvalidArgumentException $e) {
+ }
}
$searchResult->addResultSet($resultType, $result['wide'], $result['exact']);