summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2018-04-18 16:05:11 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2018-07-02 11:29:27 +0200
commit5cfe20675dfa1f895af47b4a8c93cf479d53b200 (patch)
tree66e0631e2f8791168797a4a7957a420e4ac429cf /lib
parent22bb834c48ad31add1d4bebc17de98d6e7d5d226 (diff)
downloadnextcloud-server-5cfe20675dfa1f895af47b4a8c93cf479d53b200.tar.gz
nextcloud-server-5cfe20675dfa1f895af47b4a8c93cf479d53b200.zip
start implementing federated sharing 2.0
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/composer/composer/autoload_classmap.php13
-rw-r--r--lib/composer/composer/autoload_static.php13
-rw-r--r--lib/private/Federation/CloudFederationFactory.php63
-rw-r--r--lib/private/Federation/CloudFederationNotification.php52
-rw-r--r--lib/private/Federation/CloudFederationProviderManager.php108
-rw-r--r--lib/private/Federation/CloudFederationShare.php336
-rw-r--r--lib/private/Server.php38
-rw-r--r--lib/private/Share20/ProviderFactory.php4
-rw-r--r--lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php41
-rw-r--r--lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php28
-rw-r--r--lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php40
-rw-r--r--lib/public/Federation/Exceptions/ShareNotFoundException.php29
-rw-r--r--lib/public/Federation/ICloudFederationFactory.php55
-rw-r--r--lib/public/Federation/ICloudFederationNotification.php44
-rw-r--r--lib/public/Federation/ICloudFederationProvider.php81
-rw-r--r--lib/public/Federation/ICloudFederationProviderManager.php97
-rw-r--r--lib/public/Federation/ICloudFederationShare.php233
-rw-r--r--lib/public/IServerContainer.php19
18 files changed, 1292 insertions, 2 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index f818bc2840f..8b5410919c0 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -132,6 +132,15 @@ return array(
'OCP\\Encryption\\IFile' => $baseDir . '/lib/public/Encryption/IFile.php',
'OCP\\Encryption\\IManager' => $baseDir . '/lib/public/Encryption/IManager.php',
'OCP\\Encryption\\Keys\\IStorage' => $baseDir . '/lib/public/Encryption/Keys/IStorage.php',
+ 'OCP\\Federation\\Exceptions\\ProviderAlreadyExistsException' => $baseDir . '/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php',
+ 'OCP\\Federation\\Exceptions\\ProviderCouldNotAddShareException' => $baseDir . '/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php',
+ 'OCP\\Federation\\Exceptions\\ProviderDoesNotExistsException' => $baseDir . '/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php',
+ 'OCP\\Federation\\Exceptions\\ShareNotFoundException' => $baseDir . '/lib/public/Federation/Exceptions/ShareNotFoundException.php',
+ 'OCP\\Federation\\ICloudFederationFactory' => $baseDir . '/lib/public/Federation/ICloudFederationFactory.php',
+ 'OCP\\Federation\\ICloudFederationNotification' => $baseDir . '/lib/public/Federation/ICloudFederationNotification.php',
+ 'OCP\\Federation\\ICloudFederationProvider' => $baseDir . '/lib/public/Federation/ICloudFederationProvider.php',
+ 'OCP\\Federation\\ICloudFederationProviderManager' => $baseDir . '/lib/public/Federation/ICloudFederationProviderManager.php',
+ 'OCP\\Federation\\ICloudFederationShare' => $baseDir . '/lib/public/Federation/ICloudFederationShare.php',
'OCP\\Federation\\ICloudId' => $baseDir . '/lib/public/Federation/ICloudId.php',
'OCP\\Federation\\ICloudIdManager' => $baseDir . '/lib/public/Federation/ICloudIdManager.php',
'OCP\\Files' => $baseDir . '/lib/public/Files.php',
@@ -660,6 +669,10 @@ return array(
'OC\\Encryption\\Manager' => $baseDir . '/lib/private/Encryption/Manager.php',
'OC\\Encryption\\Update' => $baseDir . '/lib/private/Encryption/Update.php',
'OC\\Encryption\\Util' => $baseDir . '/lib/private/Encryption/Util.php',
+ 'OC\\Federation\\CloudFederationFactory' => $baseDir . '/lib/private/Federation/CloudFederationFactory.php',
+ 'OC\\Federation\\CloudFederationNotification' => $baseDir . '/lib/private/Federation/CloudFederationNotification.php',
+ 'OC\\Federation\\CloudFederationProviderManager' => $baseDir . '/lib/private/Federation/CloudFederationProviderManager.php',
+ 'OC\\Federation\\CloudFederationShare' => $baseDir . '/lib/private/Federation/CloudFederationShare.php',
'OC\\Federation\\CloudId' => $baseDir . '/lib/private/Federation/CloudId.php',
'OC\\Federation\\CloudIdManager' => $baseDir . '/lib/private/Federation/CloudIdManager.php',
'OC\\Files\\AppData\\AppData' => $baseDir . '/lib/private/Files/AppData/AppData.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 05128f65c4f..36c582ccdb6 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -162,6 +162,15 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Encryption\\IFile' => __DIR__ . '/../../..' . '/lib/public/Encryption/IFile.php',
'OCP\\Encryption\\IManager' => __DIR__ . '/../../..' . '/lib/public/Encryption/IManager.php',
'OCP\\Encryption\\Keys\\IStorage' => __DIR__ . '/../../..' . '/lib/public/Encryption/Keys/IStorage.php',
+ 'OCP\\Federation\\Exceptions\\ProviderAlreadyExistsException' => __DIR__ . '/../../..' . '/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php',
+ 'OCP\\Federation\\Exceptions\\ProviderCouldNotAddShareException' => __DIR__ . '/../../..' . '/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php',
+ 'OCP\\Federation\\Exceptions\\ProviderDoesNotExistsException' => __DIR__ . '/../../..' . '/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php',
+ 'OCP\\Federation\\Exceptions\\ShareNotFoundException' => __DIR__ . '/../../..' . '/lib/public/Federation/Exceptions/ShareNotFoundException.php',
+ 'OCP\\Federation\\ICloudFederationFactory' => __DIR__ . '/../../..' . '/lib/public/Federation/ICloudFederationFactory.php',
+ 'OCP\\Federation\\ICloudFederationNotification' => __DIR__ . '/../../..' . '/lib/public/Federation/ICloudFederationNotification.php',
+ 'OCP\\Federation\\ICloudFederationProvider' => __DIR__ . '/../../..' . '/lib/public/Federation/ICloudFederationProvider.php',
+ 'OCP\\Federation\\ICloudFederationProviderManager' => __DIR__ . '/../../..' . '/lib/public/Federation/ICloudFederationProviderManager.php',
+ 'OCP\\Federation\\ICloudFederationShare' => __DIR__ . '/../../..' . '/lib/public/Federation/ICloudFederationShare.php',
'OCP\\Federation\\ICloudId' => __DIR__ . '/../../..' . '/lib/public/Federation/ICloudId.php',
'OCP\\Federation\\ICloudIdManager' => __DIR__ . '/../../..' . '/lib/public/Federation/ICloudIdManager.php',
'OCP\\Files' => __DIR__ . '/../../..' . '/lib/public/Files.php',
@@ -690,6 +699,10 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Encryption\\Manager' => __DIR__ . '/../../..' . '/lib/private/Encryption/Manager.php',
'OC\\Encryption\\Update' => __DIR__ . '/../../..' . '/lib/private/Encryption/Update.php',
'OC\\Encryption\\Util' => __DIR__ . '/../../..' . '/lib/private/Encryption/Util.php',
+ 'OC\\Federation\\CloudFederationFactory' => __DIR__ . '/../../..' . '/lib/private/Federation/CloudFederationFactory.php',
+ 'OC\\Federation\\CloudFederationNotification' => __DIR__ . '/../../..' . '/lib/private/Federation/CloudFederationNotification.php',
+ 'OC\\Federation\\CloudFederationProviderManager' => __DIR__ . '/../../..' . '/lib/private/Federation/CloudFederationProviderManager.php',
+ 'OC\\Federation\\CloudFederationShare' => __DIR__ . '/../../..' . '/lib/private/Federation/CloudFederationShare.php',
'OC\\Federation\\CloudId' => __DIR__ . '/../../..' . '/lib/private/Federation/CloudId.php',
'OC\\Federation\\CloudIdManager' => __DIR__ . '/../../..' . '/lib/private/Federation/CloudIdManager.php',
'OC\\Files\\AppData\\AppData' => __DIR__ . '/../../..' . '/lib/private/Files/AppData/AppData.php',
diff --git a/lib/private/Federation/CloudFederationFactory.php b/lib/private/Federation/CloudFederationFactory.php
new file mode 100644
index 00000000000..4f42eb50bca
--- /dev/null
+++ b/lib/private/Federation/CloudFederationFactory.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OC\Federation;
+
+use OCP\Federation\ICloudFederationFactory;
+use OCP\Federation\ICloudFederationNotification;
+use OCP\Federation\ICloudFederationShare;
+
+class CloudFederationFactory implements ICloudFederationFactory {
+
+ /**
+ * get a CloudFederationShare Object to prepare a share you want to send
+ *
+ * @param string $shareWith
+ * @param string $name resource name (e.g. document.odt)
+ * @param string $description share description (optional)
+ * @param string $providerId resource UID on the provider side
+ * @param string $owner provider specific UID of the user who owns the resource
+ * @param string $ownerDisplayName display name of the user who shared the item
+ * @param string $sharedBy provider specific UID of the user who shared the resource
+ * @param $sharedByDisplayName display name of the user who shared the resource
+ * @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]])
+ * @param string $shareType ('group' or 'user' share)
+ * @param $resourceType ('file', 'calendar',...)
+ * @return ICloudFederationShare
+ *
+ * @since 14.0.0
+ */
+ public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType) {
+ return new CloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType);
+ }
+
+ /**
+ * get a Cloud FederationNotification object to prepare a notification you
+ * want to send
+ *
+ * @return ICloudFederationNotification
+ *
+ * @since 14.0.0
+ */
+ public function getCloudFederationNotification() {
+ return new CloudFederationNotification();
+ }
+}
diff --git a/lib/private/Federation/CloudFederationNotification.php b/lib/private/Federation/CloudFederationNotification.php
new file mode 100644
index 00000000000..ed87b9b0e5d
--- /dev/null
+++ b/lib/private/Federation/CloudFederationNotification.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OC\Federation;
+
+use OCP\Federation\ICloudFederationNotification;
+
+class CloudFederationNotification implements ICloudFederationNotification {
+
+ private $message = [];
+
+ /**
+ * add a message to the notification
+ *
+ * @param string $identifier
+ * @param string $message
+ *
+ * @since 14.0.0
+ */
+ public function setMessage($identifier, $message) {
+ $this->message[$identifier] = $message;
+ }
+
+ /**
+ * get JSON encoded Message, ready to send out
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getMessage() {
+ return json_encode($this->message);
+ }
+}
diff --git a/lib/private/Federation/CloudFederationProviderManager.php b/lib/private/Federation/CloudFederationProviderManager.php
new file mode 100644
index 00000000000..925d42a688a
--- /dev/null
+++ b/lib/private/Federation/CloudFederationProviderManager.php
@@ -0,0 +1,108 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+namespace OC\Federation;
+
+use OCP\Federation\Exceptions\ProviderAlreadyExistsException;
+use OCP\Federation\Exceptions\ProviderDoesNotExistsException;
+use OCP\Federation\ICloudFederationNotification;
+use OCP\Federation\ICloudFederationProvider;
+use OCP\Federation\ICloudFederationProviderManager;
+use OCP\Federation\ICloudFederationShare;
+
+/**
+ * Class Manager
+ *
+ * Manage Cloud Federation Providers
+ *
+ * @package OC\Federation
+ */
+class CloudFederationProviderManager implements ICloudFederationProviderManager {
+
+ /** @var array list of available cloud federation providers */
+ private $cloudFederationProvider;
+
+ public function __construct() {
+ $this->cloudFederationProvider= [];
+ }
+
+
+ /**
+ * Registers an callback function which must return an cloud federation provider
+ *
+ * @param string $shareType which share type does the provider handles
+ * @param string $displayName user facing name of the federated share provider
+ * @param callable $callback
+ */
+ public function addCloudFederationProvider($shareType, $displayName, callable $callback) {
+ \OC::$server->getRemoteApiFactory();
+
+ $this->cloudFederationProvider[$shareType] = [
+ 'shareType' => $shareType,
+ 'displayName' => $displayName,
+ 'callback' => $callback,
+ ];
+
+ }
+
+ /**
+ * remove cloud federation provider
+ *
+ * @param string $providerId
+ */
+ public function removeCloudFederationProvider($providerId) {
+ unset($this->cloudFederationProvider[$providerId]);
+ }
+
+ /**
+ * get a list of all cloudFederationProviders
+ *
+ * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
+ */
+ public function getAllCloudFederationProviders() {
+ return $this->cloudFederationProvider;
+ }
+
+ /**
+ * get a specific cloud federation provider
+ *
+ * @param string $shareType
+ * @return ICloudFederationProvider
+ * @throws ProviderDoesNotExistsException
+ */
+ public function getCloudFederationProvider($shareType) {
+ if (isset($this->cloudFederationProvider[$shareType])) {
+ return call_user_func($this->cloudFederationProvider[$shareType]['callback']);
+ } else {
+ throw new ProviderDoesNotExistsException($shareType);
+ }
+ }
+
+ public function sendShare(ICloudFederationShare $share) {
+ // TODO: Implement sendShare() method.
+ }
+
+ public function sendNotification(ICloudFederationNotification $notification) {
+ // TODO: Implement sendNotification() method.
+ }
+
+}
diff --git a/lib/private/Federation/CloudFederationShare.php b/lib/private/Federation/CloudFederationShare.php
new file mode 100644
index 00000000000..4622dc096d7
--- /dev/null
+++ b/lib/private/Federation/CloudFederationShare.php
@@ -0,0 +1,336 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OC\Federation;
+
+use OCP\Federation\ICloudFederationShare;
+
+class CloudFederationShare implements ICloudFederationShare {
+
+ private $share = [
+ 'shareWith' => '',
+ 'shareType' => '',
+ 'name' => '',
+ 'resourceType' => '',
+ 'description' => '',
+ 'providerId' => '',
+ 'owner' => '',
+ 'ownerDisplayName' => '',
+ 'sharedBy' => '',
+ 'sharedByDisplayName' => '',
+ 'protocol' => []
+ ];
+
+ /**
+ * get a CloudFederationShare Object to prepare a share you want to send
+ *
+ * @param string $shareWith
+ * @param string $name resource name (e.g. document.odt)
+ * @param string $description share description (optional)
+ * @param string $providerId resource UID on the provider side
+ * @param string $owner provider specific UID of the user who owns the resource
+ * @param string $ownerDisplayName display name of the user who shared the item
+ * @param string $sharedBy provider specific UID of the user who shared the resource
+ * @param string $sharedByDisplayName display name of the user who shared the resource
+ * @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]])
+ * @param string $shareType ('group' or 'user' share)
+ * @param $resourceType ('file', 'calendar',...)
+ *
+ */
+ public function __construct($shareWith = '',
+ $name = '',
+ $description = '',
+ $providerId = '',
+ $owner = '',
+ $ownerDisplayName = '',
+ $sharedBy = '',
+ $sharedByDisplayName = '',
+ $protocol = [],
+ $shareType = '',
+ $resourceType = ''
+ ) {
+ $this->setShareWith($shareWith);
+ $this->setResourceName($name);
+ $this->setDescription($description);
+ $this->setProviderId($providerId);
+ $this->setOwner($owner);
+ $this->setOwnerDisplayName($ownerDisplayName);
+ $this->setSharedBy($sharedBy);
+ $this->setSharedByDisplayName($sharedByDisplayName);
+ $this->setProtocol($protocol);
+ $this->setShareType($shareType);
+ $this->setResourceType($resourceType);
+
+ }
+
+ /**
+ * set uid of the recipient
+ *
+ * @param string $user
+ *
+ * @since 14.0.0
+ */
+ public function setShareWith($user) {
+ $this->share['shareWith'] = $user;
+ }
+
+ /**
+ * set resource name (e.g. document.odt)
+ *
+ * @param string $name
+ *
+ * @since 14.0.0
+ */
+ public function setResourceName($name) {
+ $this->share['name'] = $name;
+ }
+
+ /**
+ * set resource type (e.g. file, calendar, contact,...)
+ *
+ * @param string $resourceType
+ *
+ * @since 14.0.0
+ */
+ public function setResourceType($resourceType) {
+ $this->share['resourceType'] = $resourceType;
+ }
+
+ /**
+ * set resource description (optional)
+ *
+ * @param string $description
+ *
+ * @since 14.0.0
+ */
+ public function setDescription($description) {
+ $this->share['description'] = $description;
+ }
+
+ /**
+ * set provider ID (e.g. file ID)
+ *
+ * @param string $providerId
+ *
+ * @since 14.0.0
+ */
+ public function setProviderId($providerId) {
+ $this->share['providerId'] = $providerId;
+ }
+
+ /**
+ * set owner UID
+ *
+ * @param string $owner
+ *
+ * @since 14.0.0
+ */
+ public function setOwner($owner) {
+ $this->share['owner'] = $owner;
+ }
+
+ /**
+ * set owner display name
+ *
+ * @param string $ownerDisplayName
+ *
+ * @since 14.0.0
+ */
+ public function setOwnerDisplayName($ownerDisplayName) {
+ $this->share['ownerDisplayName'] = $ownerDisplayName;
+ }
+
+ /**
+ * set UID of the user who sends the share
+ *
+ * @param string $sharedBy
+ *
+ * @since 14.0.0
+ */
+ public function setSharedBy($sharedBy) {
+ $this->share['sharedBy'] = $sharedBy;
+ }
+
+ /**
+ * set display name of the user who sends the share
+ *
+ * @param $sharedByDisplayName
+ *
+ * @since 14.0.0
+ */
+ public function setSharedByDisplayName($sharedByDisplayName) {
+ $this->share['sharedByDisplayName'] = $sharedByDisplayName;
+ }
+
+ /**
+ * set protocol specification
+ *
+ * @param array $protocol
+ *
+ * @since 14.0.0
+ */
+ public function setProtocol(array $protocol) {
+ $this->share['protocol'] = $protocol;
+ }
+
+ /**
+ * share type (group or user)
+ *
+ * @param string $shareType
+ *
+ * @since 14.0.0
+ */
+ public function setShareType($shareType) {
+ $this->share['shareType'] = $shareType;
+ }
+
+ /**
+ * get JSON encoded share, ready to send out
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getShare() {
+ return json_encode($this->share);
+ }
+
+ /**
+ * get uid of the recipient
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getShareWith() {
+ return $this->share['shareWith'];
+ }
+
+ /**
+ * get resource name (e.g. file, calendar, contact,...)
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getResourceName() {
+ return $this->share['name'];
+ }
+
+ /**
+ * get resource type (e.g. file, calendar, contact,...)
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getResourceType() {
+ return $this->share['resourceType'];
+ }
+
+ /**
+ * get resource description (optional)
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getDescription() {
+ return $this->share['description'];
+ }
+
+ /**
+ * get provider ID (e.g. file ID)
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getProviderId() {
+ return $this->share['providerId'];
+ }
+
+ /**
+ * get owner UID
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getOwner() {
+ return $this->share['owner'];
+ }
+
+ /**
+ * get owner display name
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getOwnerDisplayName() {
+ return $this->share['ownerDisplayName'];
+ }
+
+ /**
+ * get UID of the user who sends the share
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getSharedBy() {
+ return $this->share['sharedBy'];
+ }
+
+ /**
+ * get display name of the user who sends the share
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getSharedByDisplayName() {
+ return $this->share['sharedByDisplayName'];
+ }
+
+ /**
+ * get share type (group or user)
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getShareType() {
+ return $this->share['shareType'];
+ }
+
+ /**
+ * get protocol specification
+ *
+ * @return array
+ *
+ * @since 14.0.0
+ */
+ public function getProtocol() {
+ return $this->share['protocol'];
+ }
+}
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 3c15873206d..170bc6b2584 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -68,6 +68,8 @@ use OC\Contacts\ContactsMenu\ActionFactory;
use OC\Contacts\ContactsMenu\ContactsStore;
use OC\Diagnostics\EventLogger;
use OC\Diagnostics\QueryLogger;
+use OC\Federation\CloudFederationFactory;
+use OC\Federation\CloudFederationProviderManager;
use OC\Federation\CloudIdManager;
use OC\Files\Config\UserMountCache;
use OC\Files\Config\UserMountCacheListener;
@@ -124,9 +126,12 @@ use OCP\Collaboration\AutoComplete\IManager;
use OCP\Contacts\ContactsMenu\IContactsStore;
use OCP\Defaults;
use OCA\Theming\Util;
+use OCP\Federation\ICloudFederationFactory;
+use OCP\Federation\ICloudFederationProviderManager;
use OCP\Federation\ICloudIdManager;
use OCP\Authentication\LoginCredentials\IStore;
use OCP\Files\NotFoundException;
+use OCP\GlobalScale\IConfig;
use OCP\ICacheFactory;
use OCP\IDBConnection;
use OCP\IL10N;
@@ -1107,6 +1112,18 @@ class Server extends ServerContainer implements IServerContainer {
return new CloudIdManager();
});
+ $this->registerService(IConfig::class, function (Server $c) {
+ return new GlobalScale\Config($c->getConfig());
+ });
+
+ $this->registerService(ICloudFederationProviderManager::class, function (Server $c) {
+ return new CloudFederationProviderManager();
+ });
+
+ $this->registerService(ICloudFederationFactory::class, function (Server $c) {
+ return new CloudFederationFactory();
+ });
+
$this->registerAlias(\OCP\AppFramework\Utility\IControllerMethodReflector::class, \OC\AppFramework\Utility\ControllerMethodReflector::class);
$this->registerAlias('ControllerMethodReflector', \OCP\AppFramework\Utility\IControllerMethodReflector::class);
@@ -1974,6 +1991,20 @@ class Server extends ServerContainer implements IServerContainer {
}
/**
+ * @return \OCP\GlobalScale\IConfig
+ */
+ public function getGlobalScaleConfig() {
+ return $this->query(IConfig::class);
+ }
+
+ /**
+ * @return \OCP\Federation\ICloudFederationProviderManager
+ */
+ public function getCloudFederationProviderManager() {
+ return $this->query(ICloudFederationProviderManager::class);
+ }
+
+ /**
* @return \OCP\Remote\Api\IApiFactory
*/
public function getRemoteApiFactory() {
@@ -1981,6 +2012,13 @@ class Server extends ServerContainer implements IServerContainer {
}
/**
+ * @return \OCP\Federation\ICloudFederationFactory
+ */
+ public function getCloudFederationFactory() {
+ return $this->query(ICloudFederationFactory::class);
+ }
+
+ /**
* @return \OCP\Remote\IInstanceFactory
*/
public function getRemoteInstanceFactory() {
diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php
index 3716189445f..456b6dbc596 100644
--- a/lib/private/Share20/ProviderFactory.php
+++ b/lib/private/Share20/ProviderFactory.php
@@ -29,10 +29,10 @@
namespace OC\Share20;
use OC\CapabilitiesManager;
-use OC\GlobalScale\Config;
use OCA\FederatedFileSharing\AddressHandler;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\FederatedFileSharing\Notifications;
+use OCA\FederatedFileSharing\OCM\CloudFederationProvider;
use OCA\FederatedFileSharing\TokenHandler;
use OCA\ShareByMail\Settings\SettingsManager;
use OCA\ShareByMail\ShareByMailProvider;
@@ -133,7 +133,7 @@ class ProviderFactory implements IProviderFactory {
$this->serverContainer->getConfig(),
$this->serverContainer->getUserManager(),
$this->serverContainer->getCloudIdManager(),
- $this->serverContainer->query(Config::class)
+ $this->serverContainer->getGlobalScaleConfig()
);
}
diff --git a/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php b/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php
new file mode 100644
index 00000000000..f053a02fbea
--- /dev/null
+++ b/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Federation\Exceptions;
+
+use OC\HintException;
+
+class ProviderAlreadyExistsException extends HintException {
+
+ /**
+ * ProviderAlreadyExistsException constructor.
+ *
+ * @param string $newProviderId cloud federation provider ID of the new provider
+ * @param string $existingProviderName name of cloud federation provider which already use the same ID
+ */
+ public function __construct($newProviderId, $existingProviderName) {
+ $l = \OC::$server->getL10N('federation');
+ $message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"';
+ $hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]);
+ parent::__construct($message, $hint);
+ }
+
+}
diff --git a/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php b/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php
new file mode 100644
index 00000000000..b608437aa3c
--- /dev/null
+++ b/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Federation\Exceptions;
+
+use OC\HintException;
+
+class ProviderCouldNotAddShareException extends HintException {
+
+}
diff --git a/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php b/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php
new file mode 100644
index 00000000000..8f760d6abf4
--- /dev/null
+++ b/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Federation\Exceptions;
+
+use OC\HintException;
+
+class ProviderDoesNotExistsException extends HintException {
+
+ /**
+ * ProviderDoesNotExistsException constructor.
+ *
+ * @param string $providerId cloud federation provider ID
+ */
+ public function __construct($providerId) {
+ $l = \OC::$server->getL10N('federation');
+ $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.';
+ $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]);
+ parent::__construct($message, $hint);
+ }
+
+}
diff --git a/lib/public/Federation/Exceptions/ShareNotFoundException.php b/lib/public/Federation/Exceptions/ShareNotFoundException.php
new file mode 100644
index 00000000000..6655d5b4430
--- /dev/null
+++ b/lib/public/Federation/Exceptions/ShareNotFoundException.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Federation\Exceptions;
+
+
+use OC\HintException;
+
+class ShareNotFoundException extends HintException {
+
+}
diff --git a/lib/public/Federation/ICloudFederationFactory.php b/lib/public/Federation/ICloudFederationFactory.php
new file mode 100644
index 00000000000..e33608bcab0
--- /dev/null
+++ b/lib/public/Federation/ICloudFederationFactory.php
@@ -0,0 +1,55 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Federation;
+
+interface ICloudFederationFactory {
+
+ /**
+ * get a CloudFederationShare Object to prepare a share you want to send
+ *
+ * @param string $shareWith
+ * @param string $name resource name (e.g. document.odt)
+ * @param string $description share description (optional)
+ * @param string $providerId resource UID on the provider side
+ * @param string $owner provider specific UID of the user who owns the resource
+ * @param string $ownerDisplayName display name of the user who shared the item
+ * @param string $sharedBy provider specific UID of the user who shared the resource
+ * @param $sharedByDisplayName display name of the user who shared the resource
+ * @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]])
+ * @param string $shareType ('group' or 'user' share)
+ * @param $resourceType ('file', 'calendar',...)
+ * @return ICloudFederationShare
+ *
+ * @since 14.0.0
+ */
+ public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType);
+
+ /**
+ * get a Cloud FederationNotification object to prepare a notification you
+ * want to send
+ *
+ * @return ICloudFederationNotification
+ *
+ * @since 14.0.0
+ */
+ public function getCloudFederationNotification();
+}
diff --git a/lib/public/Federation/ICloudFederationNotification.php b/lib/public/Federation/ICloudFederationNotification.php
new file mode 100644
index 00000000000..5db93ef0a8c
--- /dev/null
+++ b/lib/public/Federation/ICloudFederationNotification.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Federation;
+
+interface ICloudFederationNotification {
+
+ /**
+ * add a message to the notification
+ *
+ * @param string $identifier
+ * @param string $message
+ *
+ * @since 14.0.0
+ */
+ public function setMessage($identifier, $message);
+
+ /**
+ * get JSON encoded Message, ready to send out
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getMessage();
+}
diff --git a/lib/public/Federation/ICloudFederationProvider.php b/lib/public/Federation/ICloudFederationProvider.php
new file mode 100644
index 00000000000..4c11fc20397
--- /dev/null
+++ b/lib/public/Federation/ICloudFederationProvider.php
@@ -0,0 +1,81 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Federation;
+
+use OCP\Federation\Exceptions\ShareNotFoundException;
+
+/**
+ * Interface ICloudFederationProvider
+ *
+ * Enable apps to create their own cloud federation provider
+ *
+ * @since 14.0.0
+ *
+ * @package OCP\Federation
+ */
+
+interface ICloudFederationProvider {
+
+ /**
+ * ICloudFederationProvider constructor.
+ *
+ * @param $shareType define the share type, handled by this provider
+ */
+ public function __construct($shareType);
+
+ /**
+ * get the name of the share type, handled by this provider
+ *
+ * @return string
+ */
+ public function getShareType();
+
+ /**
+ * send new share to another server
+ *
+ * @since 14.0.0
+ */
+ public function sendShare();
+
+ /**
+ * share received from another server
+ *
+ * @param ICloudFederationShare $share
+ * @return string provider specific unique ID of the share
+ *
+ * @since 14.0.0
+ */
+ public function shareReceived(ICloudFederationShare $share);
+
+ /**
+ * notification received from another server
+ *
+ * @param string $id unique ID of a already existing share
+ * @param array $notification provider specific notification
+ *
+ * @throws ShareNotFoundException
+ *
+ * @since 14.0.0
+ */
+ public function notificationReceived($id, $notification);
+
+}
diff --git a/lib/public/Federation/ICloudFederationProviderManager.php b/lib/public/Federation/ICloudFederationProviderManager.php
new file mode 100644
index 00000000000..c9789949245
--- /dev/null
+++ b/lib/public/Federation/ICloudFederationProviderManager.php
@@ -0,0 +1,97 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Federation;
+
+/**
+ * Class ICloudFederationProviderManager
+ *
+ * Manage cloud federation providers
+ *
+ * @since 14.0.0
+ *
+ * @package OCP\Federation
+ */
+interface ICloudFederationProviderManager {
+
+ /**
+ * Registers an callback function which must return an cloud federation provider
+ *
+ * @param string $shareType which share type does the provider handles
+ * @param string $displayName user facing name of the federated share provider
+ * @param callable $callback
+ * @throws Exceptions\ProviderAlreadyExistsException
+ *
+ * @since 14.0.0
+ */
+ public function addCloudFederationProvider($shareType, $displayName, callable $callback);
+
+ /**
+ * remove cloud federation provider
+ *
+ * @param string $shareType
+ *
+ * @since 14.0.0
+ */
+ public function removeCloudFederationProvider($shareType);
+
+ /**
+ * get a list of all cloudFederationProviders
+ *
+ * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
+ *
+ * @since 14.0.0
+ */
+ public function getAllCloudFederationProviders();
+
+ /**
+ * get a specific cloud federation provider
+ *
+ * @param string $shareType
+ * @return ICloudFederationProvider
+ * @throws Exceptions\ProviderDoesNotExistsException;
+ *
+ * @since 14.0.0
+ */
+ public function getCloudFederationProvider($shareType);
+
+ /**
+ * send federated share
+ *
+ * @param ICloudFederationShare $share
+ * @return mixed
+ *
+ * @since 14.0.0
+ */
+ public function sendShare(ICloudFederationShare $share);
+
+ /**
+ * send notification about existing share
+ *
+ * @param ICloudFederationNotification $notification
+ * @return mixed
+ *
+ * @since 14.0.0
+ */
+ public function sendNotification(ICloudFederationNotification $notification);
+
+
+}
diff --git a/lib/public/Federation/ICloudFederationShare.php b/lib/public/Federation/ICloudFederationShare.php
new file mode 100644
index 00000000000..b116da0fb54
--- /dev/null
+++ b/lib/public/Federation/ICloudFederationShare.php
@@ -0,0 +1,233 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Federation;
+
+interface ICloudFederationShare {
+
+ /**
+ * set uid of the recipient
+ *
+ * @param string $user
+ *
+ * @since 14.0.0
+ */
+ public function setShareWith($user);
+
+ /**
+ * set resource name (e.g. file, calendar, contact,...)
+ *
+ * @param string $name
+ *
+ * @since 14.0.0
+ */
+ public function setResourceName($name);
+
+ /**
+ * set resource type (e.g. file, calendar, contact,...)
+ *
+ * @param string $resourceType
+ *
+ * @since 14.0.0
+ */
+ public function setResourceType($resourceType);
+
+ /**
+ * set resource description (optional)
+ *
+ * @param string $description
+ *
+ * @since 14.0.0
+ */
+ public function setDescription($description);
+
+ /**
+ * set provider ID (e.g. file ID)
+ *
+ * @param string $providerId
+ *
+ * @since 14.0.0
+ */
+ public function setProviderId($providerId);
+
+ /**
+ * set owner UID
+ *
+ * @param string $owner
+ *
+ * @since 14.0.0
+ */
+ public function setOwner($owner);
+
+ /**
+ * set owner display name
+ *
+ * @param string $ownerDisplayName
+ *
+ * @since 14.0.0
+ */
+ public function setOwnerDisplayName($ownerDisplayName);
+
+ /**
+ * set UID of the user who sends the share
+ *
+ * @param string $sharedBy
+ *
+ * @since 14.0.0
+ */
+ public function setSharedBy($sharedBy);
+
+ /**
+ * set display name of the user who sends the share
+ *
+ * @param $sharedByDisplayName
+ *
+ * @since 14.0.0
+ */
+ public function setSharedByDisplayName($sharedByDisplayName);
+
+ /**
+ * set protocol specification
+ *
+ * @param array $protocol
+ *
+ * @since 14.0.0
+ */
+ public function setProtocol(array $protocol);
+
+ /**
+ * share type (group or user)
+ *
+ * @param string $shareType
+ *
+ * @since 14.0.0
+ */
+ public function setShareType($shareType);
+
+ /**
+ * get JSON encoded share, ready to send out
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getShare();
+
+ /**
+ * get uid of the recipient
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getShareWith();
+
+ /**
+ * get resource name (e.g. file, calendar, contact,...)
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getResourceName();
+
+ /**
+ * get resource type (e.g. file, calendar, contact,...)
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getResourceType();
+
+ /**
+ * get resource description (optional)
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getDescription();
+
+ /**
+ * get provider ID (e.g. file ID)
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getProviderId();
+
+ /**
+ * get owner UID
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getOwner();
+
+ /**
+ * get owner display name
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getOwnerDisplayName();
+
+ /**
+ * get UID of the user who sends the share
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getSharedBy();
+
+ /**
+ * get display name of the user who sends the share
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getSharedByDisplayName();
+
+ /**
+ * get share type (group or user)
+ *
+ * @return string
+ *
+ * @since 14.0.0
+ */
+ public function getShareType();
+
+ /**
+ * get protocol specification
+ *
+ * @return array
+ *
+ * @since 14.0.0
+ */
+ public function getProtocol();
+
+}
diff --git a/lib/public/IServerContainer.php b/lib/public/IServerContainer.php
index 96015d3f8a8..ebe92274a49 100644
--- a/lib/public/IServerContainer.php
+++ b/lib/public/IServerContainer.php
@@ -45,6 +45,8 @@
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
use OCP\Log\ILogFactory;
+use OCP\Federation\ICloudFederationFactory;
+use OCP\Federation\ICloudFederationProviderManager;
use OCP\Security\IContentSecurityPolicyManager;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -554,6 +556,23 @@ interface IServerContainer extends IContainer {
public function getCloudIdManager();
/**
+ * @return \OCP\GlobalScale\IConfig
+ */
+ public function getGlobalScaleConfig();
+
+ /**
+ * @return ICloudFederationFactory
+ * @since 14.0.0
+ */
+ public function getCloudFederationFactory();
+
+ /**
+ * @return ICloudFederationProviderManager
+ * @since 14.0.0
+ */
+ public function getCloudFederationProviderManager();
+
+ /**
* @return \OCP\Remote\Api\IApiFactory
* @since 13.0.0
*/