Merge pull request #58567 from nextcloud/feat/noid/search-local-account-via-lus

feat(lookup): search for local account only via lookupserver
copilot/fix-authentication-issue
Maxence Lange 2 weeks ago committed by GitHub
commit bbcab3449b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      lib/private/Collaboration/Collaborators/LookupPlugin.php
  2. 4
      lib/private/Collaboration/Collaborators/Search.php

@ -20,8 +20,6 @@ use OCP\Share\IShare;
use Psr\Log\LoggerInterface;
class LookupPlugin implements ISearchPlugin {
/** @var string remote part of the current user's cloud id */
private string $currentUserRemote;
public function __construct(
private readonly IConfig $config,
@ -33,7 +31,6 @@ class LookupPlugin implements ISearchPlugin {
private readonly GlobalScaleConfig $globalScaleConfig,
) {
$currentUserCloudId = $userSession->getUser()->getCloudId();
$this->currentUserRemote = $cloudIdManager->resolveCloudId($currentUserCloudId)->getRemote();
}
#[\Override]
@ -77,9 +74,6 @@ class LookupPlugin implements ISearchPlugin {
]);
continue;
}
if ($this->currentUserRemote === $remote) {
continue;
}
$name = $lookup['name']['value'] ?? '';
$label = empty($name) ? $lookup['federationId'] : $name . ' (' . $lookup['federationId'] . ')';
$result[] = [

@ -47,6 +47,10 @@ class Search implements ISearch {
foreach ($this->pluginList[$type] as $plugin) {
/** @var ISearchPlugin $searchPlugin */
$searchPlugin = $this->container->resolve($plugin);
if ($searchPlugin instanceof UserPlugin && $lookup) {
// we are in GlobalScale, we ignore local accounts and prefer the result from lookup
continue;
}
$hasMoreResults = $searchPlugin->search($search, $limit, $offset, $searchResult) || $hasMoreResults;
}
}

Loading…
Cancel
Save