summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/api
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-02-25 20:46:01 +0100
committerLukas Reschke <lukas@owncloud.com>2016-02-26 09:26:55 +0100
commit59028cced0a4f7377de9c22012c7624440b14a56 (patch)
treedc209a35e1626309032640459bec268323e51bac /apps/files_sharing/api
parentcb41b1a86397579d55e0ce96e67b80a83037d1d2 (diff)
downloadnextcloud-server-59028cced0a4f7377de9c22012c7624440b14a56.tar.gz
nextcloud-server-59028cced0a4f7377de9c22012c7624440b14a56.zip
Add autodiscovery support to server-to-server sharing
Adds autodiscovery support to server-to-server sharing as specified in the specification. If no discovery data is found it is using the fallback ownCloud endpoints for legacy support.
Diffstat (limited to 'apps/files_sharing/api')
-rw-r--r--apps/files_sharing/api/remote.php31
-rw-r--r--apps/files_sharing/api/server2server.php6
2 files changed, 37 insertions, 0 deletions
diff --git a/apps/files_sharing/api/remote.php b/apps/files_sharing/api/remote.php
index 8b47955b51e..1b5eb28aa86 100644
--- a/apps/files_sharing/api/remote.php
+++ b/apps/files_sharing/api/remote.php
@@ -24,6 +24,7 @@
namespace OCA\Files_Sharing\API;
use OC\Files\Filesystem;
+use OCA\FederatedFileSharing\DiscoveryManager;
use OCA\Files_Sharing\External\Manager;
class Remote {
@@ -35,12 +36,17 @@ class Remote {
* @return \OC_OCS_Result
*/
public static function getOpenShares($params) {
+ $discoveryManager = new DiscoveryManager(
+ \OC::$server->getMemCacheFactory(),
+ \OC::$server->getHTTPClientService()
+ );
$externalManager = new Manager(
\OC::$server->getDatabaseConnection(),
Filesystem::getMountManager(),
Filesystem::getLoader(),
\OC::$server->getHTTPHelper(),
\OC::$server->getNotificationManager(),
+ $discoveryManager,
\OC_User::getUser()
);
@@ -54,12 +60,17 @@ class Remote {
* @return \OC_OCS_Result
*/
public static function acceptShare($params) {
+ $discoveryManager = new DiscoveryManager(
+ \OC::$server->getMemCacheFactory(),
+ \OC::$server->getHTTPClientService()
+ );
$externalManager = new Manager(
\OC::$server->getDatabaseConnection(),
Filesystem::getMountManager(),
Filesystem::getLoader(),
\OC::$server->getHTTPHelper(),
\OC::$server->getNotificationManager(),
+ $discoveryManager,
\OC_User::getUser()
);
@@ -80,12 +91,17 @@ class Remote {
* @return \OC_OCS_Result
*/
public static function declineShare($params) {
+ $discoveryManager = new DiscoveryManager(
+ \OC::$server->getMemCacheFactory(),
+ \OC::$server->getHTTPClientService()
+ );
$externalManager = new Manager(
\OC::$server->getDatabaseConnection(),
Filesystem::getMountManager(),
Filesystem::getLoader(),
\OC::$server->getHTTPHelper(),
\OC::$server->getNotificationManager(),
+ $discoveryManager,
\OC_User::getUser()
);
@@ -123,12 +139,17 @@ class Remote {
* @return \OC_OCS_Result
*/
public static function getShares($params) {
+ $discoveryManager = new DiscoveryManager(
+ \OC::$server->getMemCacheFactory(),
+ \OC::$server->getHTTPClientService()
+ );
$externalManager = new Manager(
\OC::$server->getDatabaseConnection(),
Filesystem::getMountManager(),
Filesystem::getLoader(),
\OC::$server->getHTTPHelper(),
\OC::$server->getNotificationManager(),
+ $discoveryManager,
\OC_User::getUser()
);
@@ -146,12 +167,17 @@ class Remote {
* @return \OC_OCS_Result
*/
public static function getShare($params) {
+ $discoveryManager = new DiscoveryManager(
+ \OC::$server->getMemCacheFactory(),
+ \OC::$server->getHTTPClientService()
+ );
$externalManager = new Manager(
\OC::$server->getDatabaseConnection(),
Filesystem::getMountManager(),
Filesystem::getLoader(),
\OC::$server->getHTTPHelper(),
\OC::$server->getNotificationManager(),
+ $discoveryManager,
\OC_User::getUser()
);
@@ -172,12 +198,17 @@ class Remote {
* @return \OC_OCS_Result
*/
public static function unshare($params) {
+ $discoveryManager = new DiscoveryManager(
+ \OC::$server->getMemCacheFactory(),
+ \OC::$server->getHTTPClientService()
+ );
$externalManager = new Manager(
\OC::$server->getDatabaseConnection(),
Filesystem::getMountManager(),
Filesystem::getLoader(),
\OC::$server->getHTTPHelper(),
\OC::$server->getNotificationManager(),
+ $discoveryManager,
\OC_User::getUser()
);
diff --git a/apps/files_sharing/api/server2server.php b/apps/files_sharing/api/server2server.php
index f04ddc81b84..6da95ed6549 100644
--- a/apps/files_sharing/api/server2server.php
+++ b/apps/files_sharing/api/server2server.php
@@ -25,6 +25,7 @@
namespace OCA\Files_Sharing\API;
+use OCA\FederatedFileSharing\DiscoveryManager;
use OCA\Files_Sharing\Activity;
use OCP\Files\NotFoundException;
@@ -70,12 +71,17 @@ class Server2Server {
\OC_Util::setupFS($shareWith);
+ $discoveryManager = new DiscoveryManager(
+ \OC::$server->getMemCacheFactory(),
+ \OC::$server->getHTTPClientService()
+ );
$externalManager = new \OCA\Files_Sharing\External\Manager(
\OC::$server->getDatabaseConnection(),
\OC\Files\Filesystem::getMountManager(),
\OC\Files\Filesystem::getLoader(),
\OC::$server->getHTTPHelper(),
\OC::$server->getNotificationManager(),
+ $discoveryManager,
$shareWith
);