Skip to content

Commit bbcab34

Browse files
Merge pull request #58567 from nextcloud/feat/noid/search-local-account-via-lus
feat(lookup): search for local account only via lookupserver
2 parents 82b2ab2 + eb50963 commit bbcab34

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

‎lib/private/Collaboration/Collaborators/LookupPlugin.php‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
use Psr\Log\LoggerInterface;
2121

2222
class LookupPlugin implements ISearchPlugin {
23-
/** @var string remote part of the current user's cloud id */
24-
private string $currentUserRemote;
2523

2624
public function __construct(
2725
private readonly IConfig $config,
@@ -33,7 +31,6 @@ public function __construct(
3331
private readonly GlobalScaleConfig $globalScaleConfig,
3432
) {
3533
$currentUserCloudId = $userSession->getUser()->getCloudId();
36-
$this->currentUserRemote = $cloudIdManager->resolveCloudId($currentUserCloudId)->getRemote();
3734
}
3835

3936
#[\Override]
@@ -77,9 +74,6 @@ public function search($search, $limit, $offset, ISearchResult $searchResult): b
7774
]);
7875
continue;
7976
}
80-
if ($this->currentUserRemote === $remote) {
81-
continue;
82-
}
8377
$name = $lookup['name']['value'] ?? '';
8478
$label = empty($name) ? $lookup['federationId'] : $name . ' (' . $lookup['federationId'] . ')';
8579
$result[] = [

‎lib/private/Collaboration/Collaborators/Search.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public function search($search, array $shareTypes, $lookup, $limit, $offset): ar
4747
foreach ($this->pluginList[$type] as $plugin) {
4848
/** @var ISearchPlugin $searchPlugin */
4949
$searchPlugin = $this->container->resolve($plugin);
50+
if ($searchPlugin instanceof UserPlugin && $lookup) {
51+
// we are in GlobalScale, we ignore local accounts and prefer the result from lookup
52+
continue;
53+
}
5054
$hasMoreResults = $searchPlugin->search($search, $limit, $offset, $searchResult) || $hasMoreResults;
5155
}
5256
}

0 commit comments

Comments
 (0)