From a1193b127dc9817f39bc6ad1b48b5d9b7e2d938a Mon Sep 17 00:00:00 2001 From: Cristian Scheid Date: Sat, 24 Jan 2026 08:59:25 -0300 Subject: [PATCH 1/3] feat(contacts): support federated users/groups search when adding team members Signed-off-by: Cristian Scheid --- .../lib/Controller/ShareesAPIController.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php index 158e653dba146..263b36b8c90cc 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -11,6 +11,7 @@ use Generator; use OC\Collaboration\Collaborators\SearchResult; use OC\Share\Share; +use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\Files_Sharing\ResponseDefinitions; use OCP\App\IAppManager; use OCP\AppFramework\Http; @@ -72,6 +73,7 @@ public function __construct( protected IURLGenerator $urlGenerator, protected IManager $shareManager, protected ISearch $collaboratorSearch, + protected FederatedShareProvider $federatedShareProvider, ) { parent::__construct($appName, $request); } @@ -141,6 +143,20 @@ public function search(string $search = '', ?string $itemType = null, int $page if ($this->shareManager->shareProviderExists(IShare::TYPE_ROOM)) { $shareTypes[] = IShare::TYPE_ROOM; } + } elseif ($itemType === 'contacts') { + if ($this->shareManager->allowGroupSharing()) { + $shareTypes[] = IShare::TYPE_GROUP; + } + + if ($this->federatedShareProvider->isOutgoingServer2serverShareEnabled()) { + $shareTypes[] = IShare::TYPE_REMOTE; + } + + if ($this->federatedShareProvider->isOutgoingServer2serverGroupShareEnabled()) { + $shareTypes[] = IShare::TYPE_REMOTE_GROUP; + } + + $shareTypes[] = IShare::TYPE_EMAIL; } else { if ($this->shareManager->allowGroupSharing()) { $shareTypes[] = IShare::TYPE_GROUP; From e249b7e4e1529f7bb9d7d7f819330477a971a169 Mon Sep 17 00:00:00 2001 From: Cristian Scheid Date: Wed, 4 Feb 2026 08:23:13 -0300 Subject: [PATCH 2/3] refactor(teams): adjust expected itemType and remove remote group type from member search controller Signed-off-by: Cristian Scheid --- apps/files_sharing/lib/Controller/ShareesAPIController.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php index 263b36b8c90cc..bdf9e638928cc 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -143,7 +143,7 @@ public function search(string $search = '', ?string $itemType = null, int $page if ($this->shareManager->shareProviderExists(IShare::TYPE_ROOM)) { $shareTypes[] = IShare::TYPE_ROOM; } - } elseif ($itemType === 'contacts') { + } elseif ($itemType === 'teams') { if ($this->shareManager->allowGroupSharing()) { $shareTypes[] = IShare::TYPE_GROUP; } @@ -152,10 +152,6 @@ public function search(string $search = '', ?string $itemType = null, int $page $shareTypes[] = IShare::TYPE_REMOTE; } - if ($this->federatedShareProvider->isOutgoingServer2serverGroupShareEnabled()) { - $shareTypes[] = IShare::TYPE_REMOTE_GROUP; - } - $shareTypes[] = IShare::TYPE_EMAIL; } else { if ($this->shareManager->allowGroupSharing()) { From f0517dbdd9c8cedcc4c191564e6bc7ee46ec7523 Mon Sep 17 00:00:00 2001 From: Cristian Scheid Date: Thu, 5 Feb 2026 08:22:13 -0300 Subject: [PATCH 3/3] test(files_sharing): update ShareesAPIController mock to include FederatedShareProvider dependency Signed-off-by: Cristian Scheid --- .../tests/Controller/ShareesAPIControllerTest.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php index 889ae3fb86ebb..1c016779e9fa8 100644 --- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php @@ -7,6 +7,7 @@ */ namespace OCA\Files_Sharing\Tests\Controller; +use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\Files_Sharing\Controller\ShareesAPIController; use OCA\Files_Sharing\Tests\TestCase; use OCP\AppFramework\Http\DataResponse; @@ -46,6 +47,9 @@ class ShareesAPIControllerTest extends TestCase { /** @var IConfig|MockObject */ protected $config; + /** @var FederatedShareProvider|MockObject */ + protected $federatedShareProvider; + protected function setUp(): void { parent::setUp(); @@ -58,6 +62,7 @@ protected function setUp(): void { $urlGeneratorMock = $this->createMock(IURLGenerator::class); $this->collaboratorSearch = $this->createMock(ISearch::class); + $this->federatedShareProvider = $this->createMock(FederatedShareProvider::class); $this->sharees = new ShareesAPIController( 'files_sharing', @@ -66,7 +71,8 @@ protected function setUp(): void { $this->config, $urlGeneratorMock, $this->shareManager, - $this->collaboratorSearch + $this->collaboratorSearch, + $this->federatedShareProvider ); } @@ -260,7 +266,8 @@ public function testSearch( $config, $urlGenerator, $this->shareManager, - $this->collaboratorSearch + $this->collaboratorSearch, + $this->federatedShareProvider ]) ->onlyMethods(['isRemoteSharingAllowed', 'isRemoteGroupSharingAllowed']) ->getMock(); @@ -359,7 +366,8 @@ public function testSearchInvalid($getData, $message): void { $config, $urlGenerator, $this->shareManager, - $this->collaboratorSearch + $this->collaboratorSearch, + $this->federatedShareProvider ]) ->onlyMethods(['isRemoteSharingAllowed']) ->getMock();