Merge pull request #58126 from nextcloud/backport/57782/stable33

[stable33] feat(contacts): support federated users/groups search when adding team members
This commit is contained in:
Andy Scherzinger 2026-02-06 14:01:14 +01:00 committed by GitHub
commit 285decb94a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 3 deletions

View file

@ -11,6 +11,7 @@ namespace OCA\Files_Sharing\Controller;
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 @@ class ShareesAPIController extends OCSController {
protected IURLGenerator $urlGenerator,
protected IManager $shareManager,
protected ISearch $collaboratorSearch,
protected FederatedShareProvider $federatedShareProvider,
) {
parent::__construct($appName, $request);
}
@ -141,6 +143,16 @@ class ShareesAPIController extends OCSController {
if ($this->shareManager->shareProviderExists(IShare::TYPE_ROOM)) {
$shareTypes[] = IShare::TYPE_ROOM;
}
} elseif ($itemType === 'teams') {
if ($this->shareManager->allowGroupSharing()) {
$shareTypes[] = IShare::TYPE_GROUP;
}
if ($this->federatedShareProvider->isOutgoingServer2serverShareEnabled()) {
$shareTypes[] = IShare::TYPE_REMOTE;
}
$shareTypes[] = IShare::TYPE_EMAIL;
} else {
if ($this->shareManager->allowGroupSharing()) {
$shareTypes[] = IShare::TYPE_GROUP;

View file

@ -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 @@ class ShareesAPIControllerTest extends TestCase {
$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 @@ class ShareesAPIControllerTest extends TestCase {
$this->config,
$urlGeneratorMock,
$this->shareManager,
$this->collaboratorSearch
$this->collaboratorSearch,
$this->federatedShareProvider
);
}
@ -260,7 +266,8 @@ class ShareesAPIControllerTest extends TestCase {
$config,
$urlGenerator,
$this->shareManager,
$this->collaboratorSearch
$this->collaboratorSearch,
$this->federatedShareProvider
])
->onlyMethods(['isRemoteSharingAllowed', 'isRemoteGroupSharingAllowed'])
->getMock();
@ -359,7 +366,8 @@ class ShareesAPIControllerTest extends TestCase {
$config,
$urlGenerator,
$this->shareManager,
$this->collaboratorSearch
$this->collaboratorSearch,
$this->federatedShareProvider
])
->onlyMethods(['isRemoteSharingAllowed'])
->getMock();