summaryrefslogtreecommitdiffstats
path: root/lib/private/Collaboration
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-05-23 17:03:04 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2019-10-29 12:55:59 +0100
commitea6f423e2c8e50cf1357a0e2182dc4c9a9bf981e (patch)
tree76b213c328abf5b40a54062dd4da339caba20903 /lib/private/Collaboration
parent3b8f83f5af748bbf874b3c5e678de8eccf9b3384 (diff)
downloadnextcloud-server-ea6f423e2c8e50cf1357a0e2182dc4c9a9bf981e.tar.gz
nextcloud-server-ea6f423e2c8e50cf1357a0e2182dc4c9a9bf981e.zip
Extend data returned when searching remote shares
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib/private/Collaboration')
-rw-r--r--lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php22
-rw-r--r--lib/private/Collaboration/Collaborators/RemotePlugin.php5
2 files changed, 25 insertions, 2 deletions
diff --git a/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php b/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php
index 6e0979fe418..d9e1f2fd49a 100644
--- a/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php
+++ b/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php
@@ -57,11 +57,15 @@ class RemoteGroupPlugin implements ISearchPlugin {
$resultType = new SearchResultType('remote_groups');
if ($this->enabled && $this->cloudIdManager->isValidCloudId($search) && $offset === 0) {
+ list($remoteGroup, $serverUrl) = $this->splitGroupRemote($search);
$result['exact'][] = [
- 'label' => $search,
+ 'label' => $remoteGroup . " ($serverUrl)",
+ 'guid' => $remoteGroup,
+ 'name' => $remoteGroup,
'value' => [
'shareType' => Share::SHARE_TYPE_REMOTE_GROUP,
'shareWith' => $search,
+ 'server' => $serverUrl,
],
];
}
@@ -71,4 +75,20 @@ class RemoteGroupPlugin implements ISearchPlugin {
return true;
}
+ /**
+ * split group and remote from federated cloud id
+ *
+ * @param string $address federated share address
+ * @return array [user, remoteURL]
+ * @throws \InvalidArgumentException
+ */
+ public function splitGroupRemote($address) {
+ try {
+ $cloudId = $this->cloudIdManager->resolveCloudId($address);
+ return [$cloudId->getUser(), $cloudId->getRemote()];
+ } catch (\InvalidArgumentException $e) {
+ throw new \InvalidArgumentException('Invalid Federated Cloud ID', 0, $e);
+ }
+ }
+
}
diff --git a/lib/private/Collaboration/Collaborators/RemotePlugin.php b/lib/private/Collaboration/Collaborators/RemotePlugin.php
index d877346b155..fd14e7e03be 100644
--- a/lib/private/Collaboration/Collaborators/RemotePlugin.php
+++ b/lib/private/Collaboration/Collaborators/RemotePlugin.php
@@ -152,10 +152,13 @@ class RemotePlugin implements ISearchPlugin {
$localUser = $this->userManager->get($remoteUser);
if ($localUser === null || $search !== $localUser->getCloudId()) {
$result['exact'][] = [
- 'label' => $search,
+ 'label' => $remoteUser . " ($serverUrl)",
+ 'uuid' => $remoteUser,
+ 'name' => $remoteUser,
'value' => [
'shareType' => Share::SHARE_TYPE_REMOTE,
'shareWith' => $search,
+ 'server' => $serverUrl,
],
];
}