Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apps/files_sharing/lib/Controller/ShareesAPIController.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -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;
Expand DownExpand Up@@ -72,6 +73,7 @@ public function __construct(
protected IURLGenerator $urlGenerator,
protected IManager $shareManager,
protected ISearch $collaboratorSearch,
protected FederatedShareProvider $federatedShareProvider,
) {
parent::__construct($appName, $request);
}
Expand DownExpand Up@@ -141,6 +143,16 @@ public function search(string $search = '', ?string $itemType = null, int $page
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;
Expand Down
14 changes: 11 additions & 3 deletions apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -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;
Expand DownExpand Up@@ -46,6 +47,9 @@ class ShareesAPIControllerTest extends TestCase {
/** @var IConfig|MockObject */
protected $config;

/** @var FederatedShareProvider|MockObject */
protected $federatedShareProvider;

protected function setUp(): void {
parent::setUp();

Expand All@@ -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',
Expand All@@ -66,7 +71,8 @@ protected function setUp(): void {
$this->config,
$urlGeneratorMock,
$this->shareManager,
$this->collaboratorSearch
$this->collaboratorSearch,
$this->federatedShareProvider
);
}

Expand DownExpand Up@@ -260,7 +266,8 @@ public function testSearch(
$config,
$urlGenerator,
$this->shareManager,
$this->collaboratorSearch
$this->collaboratorSearch,
$this->federatedShareProvider
])
->onlyMethods(['isRemoteSharingAllowed', 'isRemoteGroupSharingAllowed'])
->getMock();
Expand DownExpand Up@@ -359,7 +366,8 @@ public function testSearchInvalid($getData, $message): void {
$config,
$urlGenerator,
$this->shareManager,
$this->collaboratorSearch
$this->collaboratorSearch,
$this->federatedShareProvider
])
->onlyMethods(['isRemoteSharingAllowed'])
->getMock();
Expand Down
Loading