aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2025-03-10 16:24:26 +0100
committerFerdinand Thiessen <opensource@fthiessen.de>2025-03-11 14:26:47 +0100
commit00d08a4f692f66a697080dbd353bcd6d66a6b67b (patch)
tree2b69ce1b221f3256ed137bb239367c1680fbb1a1 /apps/files_sharing
parent34251c4375cd2b0b26b2f5f4b8cbe3bd4c50f8a3 (diff)
downloadnextcloud-server-00d08a4f692f66a697080dbd353bcd6d66a6b67b.tar.gz
nextcloud-server-00d08a4f692f66a697080dbd353bcd6d66a6b67b.zip
fix(lookup-server): disable lookup server for non-global scale setups
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/Controller/ShareesAPIController.php10
-rw-r--r--apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php13
2 files changed, 12 insertions, 11 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php
index 3390c896532..0c458ce9662 100644
--- a/apps/files_sharing/lib/Controller/ShareesAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php
@@ -22,6 +22,7 @@ use OCP\Collaboration\Collaborators\ISearch;
use OCP\Collaboration\Collaborators\ISearchResult;
use OCP\Collaboration\Collaborators\SearchResultType;
use OCP\Constants;
+use OCP\GlobalScale\IConfig as GlobalScaleIConfig;
use OCP\IConfig;
use OCP\IRequest;
use OCP\IURLGenerator;
@@ -175,12 +176,11 @@ class ShareesAPIController extends OCSController {
$this->limit = $perPage;
$this->offset = $perPage * ($page - 1);
- // In global scale mode we always search the loogup server
- $lookup = $this->config->getSystemValueBool('gs.enabled', false)
- || $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'no') === 'yes';
- $this->result['lookupEnabled'] = $lookup;
+ // In global scale mode we always search the lookup server
+ $this->result['lookupEnabled'] = Server::get(GlobalScaleIConfig::class)->isGlobalScaleEnabled();
+ // TODO: Reconsider using lookup server for non-global-scale federation
- [$result, $hasMoreResults] = $this->collaboratorSearch->search($search, $shareTypes, $lookup, $this->limit, $this->offset);
+ [$result, $hasMoreResults] = $this->collaboratorSearch->search($search, $shareTypes, $this->result['lookupEnabled'], $this->limit, $this->offset);
// extra treatment for 'exact' subarray, with a single merge expected keys might be lost
if (isset($result['exact'])) {
diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
index f000d80fd8c..c8113558f6c 100644
--- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
@@ -11,6 +11,7 @@ use OCA\Files_Sharing\Tests\TestCase;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCS\OCSBadRequestException;
use OCP\Collaboration\Collaborators\ISearch;
+use OCP\GlobalScale\IConfig as GlobalScaleIConfig;
use OCP\IConfig;
use OCP\IRequest;
use OCP\IURLGenerator;
@@ -229,14 +230,14 @@ class ShareesAPIControllerTest extends TestCase {
$perPage = $getData['perPage'] ?? 200;
$shareType = $getData['shareType'] ?? null;
+ $globalConfig = $this->createMock(GlobalScaleIConfig::class);
+ $globalConfig->expects(self::once())
+ ->method('isGlobalScaleEnabled')
+ ->willReturn(true);
+ $this->overwriteService(GlobalScaleIConfig::class, $globalConfig);
+
/** @var IConfig|MockObject $config */
$config = $this->createMock(IConfig::class);
- $config->expects($this->exactly(1))
- ->method('getAppValue')
- ->with($this->anything(), $this->anything(), $this->anything())
- ->willReturnMap([
- ['files_sharing', 'lookupServerEnabled', 'no', 'yes'],
- ]);
$this->shareManager->expects($this->once())
->method('allowGroupSharing')