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
4 changes: 4 additions & 0 deletions lib/private/Collaboration/Collaborators/LookupPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
namespace OC\Collaboration\Collaborators;

use OCA\Federation\TrustedServers;
use OCP\Collaboration\Collaborators\ISearchPlugin;
use OCP\Collaboration\Collaborators\ISearchResult;
use OCP\Collaboration\Collaborators\SearchResultType;
Expand All @@ -26,6 +27,7 @@ public function __construct(
IUserSession $userSession,
private ICloudIdManager $cloudIdManager,
private LoggerInterface $logger,
private ?TrustedServers $trustedServers,
) {
$currentUserCloudId = $userSession->getUser()->getCloudId();
$this->currentUserRemote = $cloudIdManager->resolveCloudId($currentUserCloudId)->getRemote();
Expand Down Expand Up @@ -82,6 +84,8 @@ public function search($search, $limit, $offset, ISearchResult $searchResult): b
'shareType' => IShare::TYPE_REMOTE,
'globalScale' => $isGlobalScaleEnabled,
'shareWith' => $lookup['federationId'],
'server' => $remote,
'isTrustedServer' => $this->trustedServers?->isTrustedServer($remote) ?? false,
],
'extra' => $lookup,
];
Expand Down
43 changes: 33 additions & 10 deletions tests/lib/Collaboration/Collaborators/LookupPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ protected function setUp(): void {
if ($cloudId === '[email protected]') {
return new CloudId('[email protected]', 'user', 'myNextcloud.net');
}
if (str_contains($cloudId, '@enceladus.moon')) {
[$user, $remote] = explode('@', $cloudId, 2);
return new CloudId($cloudId, $user, $remote);
}
return new CloudId('[email protected]', 'user', 'someNextcloud.net');
});

Expand All @@ -66,7 +70,8 @@ protected function setUp(): void {
$this->clientService,
$this->userSession,
$this->cloudIdManager,
$this->logger
$this->logger,
null
);
}

Expand Down Expand Up @@ -286,7 +291,9 @@ public static function dataSearchEnableDisableLookupServer(): array {
'value' => [
'shareType' => IShare::TYPE_REMOTE,
'globalScale' => true,
'shareWith' => $fedIDs[0]
'shareWith' => $fedIDs[0],
'server' => 'enceladus.moon',
'isTrustedServer' => false,
],
'extra' => ['federationId' => $fedIDs[0]],
],
Expand All @@ -295,7 +302,9 @@ public static function dataSearchEnableDisableLookupServer(): array {
'value' => [
'shareType' => IShare::TYPE_REMOTE,
'globalScale' => true,
'shareWith' => $fedIDs[1]
'shareWith' => $fedIDs[1],
'server' => 'enceladus.moon',
'isTrustedServer' => false,
],
'extra' => ['federationId' => $fedIDs[1]],
],
Expand All @@ -304,7 +313,9 @@ public static function dataSearchEnableDisableLookupServer(): array {
'value' => [
'shareType' => IShare::TYPE_REMOTE,
'globalScale' => true,
'shareWith' => $fedIDs[2]
'shareWith' => $fedIDs[2],
'server' => 'enceladus.moon',
'isTrustedServer' => false,
],
'extra' => ['federationId' => $fedIDs[2]],
],
Expand All @@ -328,7 +339,9 @@ public static function dataSearchEnableDisableLookupServer(): array {
'value' => [
'shareType' => IShare::TYPE_REMOTE,
'globalScale' => true,
'shareWith' => $fedIDs[0]
'shareWith' => $fedIDs[0],
'server' => 'enceladus.moon',
'isTrustedServer' => false,
],
'extra' => ['federationId' => $fedIDs[0]],
],
Expand All @@ -337,7 +350,9 @@ public static function dataSearchEnableDisableLookupServer(): array {
'value' => [
'shareType' => IShare::TYPE_REMOTE,
'globalScale' => true,
'shareWith' => $fedIDs[1]
'shareWith' => $fedIDs[1],
'server' => 'enceladus.moon',
'isTrustedServer' => false,
],
'extra' => ['federationId' => $fedIDs[1]],
],
Expand All @@ -346,7 +361,9 @@ public static function dataSearchEnableDisableLookupServer(): array {
'value' => [
'shareType' => IShare::TYPE_REMOTE,
'globalScale' => true,
'shareWith' => $fedIDs[2]
'shareWith' => $fedIDs[2],
'server' => 'enceladus.moon',
'isTrustedServer' => false,
],
'extra' => ['federationId' => $fedIDs[2]],
],
Expand Down Expand Up @@ -460,7 +477,9 @@ public static function searchDataProvider(): array {
'value' => [
'shareType' => IShare::TYPE_REMOTE,
'globalScale' => true,
'shareWith' => $fedIDs[0]
'shareWith' => $fedIDs[0],
'server' => 'enceladus.moon',
'isTrustedServer' => false,
],
'extra' => ['federationId' => $fedIDs[0]],
],
Expand All @@ -469,7 +488,9 @@ public static function searchDataProvider(): array {
'value' => [
'shareType' => IShare::TYPE_REMOTE,
'globalScale' => true,
'shareWith' => $fedIDs[1]
'shareWith' => $fedIDs[1],
'server' => 'enceladus.moon',
'isTrustedServer' => false,
],
'extra' => ['federationId' => $fedIDs[1]],
],
Expand All @@ -478,7 +499,9 @@ public static function searchDataProvider(): array {
'value' => [
'shareType' => IShare::TYPE_REMOTE,
'globalScale' => true,
'shareWith' => $fedIDs[2]
'shareWith' => $fedIDs[2],
'server' => 'enceladus.moon',
'isTrustedServer' => false,
],
'extra' => ['federationId' => $fedIDs[2]],
],
Expand Down
Loading