2016-04-18 16:17:08 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-21 14:49:16 +00:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2017-11-06 14:56:42 +00:00
|
|
|
* @author Bjoern Schiessle <bjoern@schiessle.org>
|
2016-05-26 17:56:05 +00:00
|
|
|
* @author Björn Schießle <bjoern@schiessle.org>
|
2017-11-06 14:56:42 +00:00
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2016-04-18 16:17:08 +00:00
|
|
|
*
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* 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, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
namespace OCA\FederatedFileSharing\AppInfo;
|
|
|
|
|
|
|
|
|
2016-08-19 10:01:13 +00:00
|
|
|
use OC\AppFramework\Utility\SimpleContainer;
|
|
|
|
use OCA\FederatedFileSharing\AddressHandler;
|
|
|
|
use OCA\FederatedFileSharing\Controller\RequestHandlerController;
|
2016-04-18 16:17:08 +00:00
|
|
|
use OCA\FederatedFileSharing\FederatedShareProvider;
|
2016-08-19 10:01:13 +00:00
|
|
|
use OCA\FederatedFileSharing\Notifications;
|
2018-04-18 14:05:11 +00:00
|
|
|
use OCA\FederatedFileSharing\OCM\CloudFederationProvider;
|
2018-04-30 09:49:24 +00:00
|
|
|
use OCA\FederatedFileSharing\OCM\CloudFederationProviderFiles;
|
2016-04-18 16:17:08 +00:00
|
|
|
use OCP\AppFramework\App;
|
2017-05-24 07:07:58 +00:00
|
|
|
use OCP\GlobalScale\IConfig;
|
2016-04-18 16:17:08 +00:00
|
|
|
|
|
|
|
class Application extends App {
|
|
|
|
|
|
|
|
/** @var FederatedShareProvider */
|
|
|
|
protected $federatedShareProvider;
|
|
|
|
|
2016-05-23 09:48:14 +00:00
|
|
|
public function __construct() {
|
|
|
|
parent::__construct('federatedfilesharing');
|
2016-08-19 10:01:13 +00:00
|
|
|
|
|
|
|
$container = $this->getContainer();
|
|
|
|
$server = $container->getServer();
|
|
|
|
|
2018-04-18 14:05:11 +00:00
|
|
|
$cloudFederationManager = $server->getCloudFederationProviderManager();
|
|
|
|
$cloudFederationManager->addCloudFederationProvider('file',
|
|
|
|
'Federated Files Sharing',
|
|
|
|
function() use ($container) {
|
2018-04-30 09:49:24 +00:00
|
|
|
$server = $container->getServer();
|
|
|
|
return new CloudFederationProviderFiles(
|
|
|
|
$server->getAppManager(),
|
|
|
|
$server->query(FederatedShareProvider::class),
|
|
|
|
$server->query(AddressHandler::class),
|
|
|
|
$server->getLogger(),
|
|
|
|
$server->getUserManager(),
|
|
|
|
$server->getCloudIdManager(),
|
|
|
|
$server->getActivityManager(),
|
|
|
|
$server->getNotificationManager(),
|
2018-05-30 15:44:08 +00:00
|
|
|
$server->getURLGenerator(),
|
|
|
|
$server->getCloudFederationFactory(),
|
2018-06-04 14:36:37 +00:00
|
|
|
$server->getCloudFederationProviderManager(),
|
2018-06-13 12:19:59 +00:00
|
|
|
$server->getDatabaseConnection(),
|
|
|
|
$server->getGroupManager()
|
2018-04-30 09:49:24 +00:00
|
|
|
);
|
2018-04-18 14:05:11 +00:00
|
|
|
});
|
|
|
|
|
2016-08-19 10:01:13 +00:00
|
|
|
$container->registerService('RequestHandlerController', function(SimpleContainer $c) use ($server) {
|
|
|
|
$addressHandler = new AddressHandler(
|
|
|
|
$server->getURLGenerator(),
|
2017-01-27 11:52:17 +00:00
|
|
|
$server->getL10N('federatedfilesharing'),
|
|
|
|
$server->getCloudIdManager()
|
2016-08-19 10:01:13 +00:00
|
|
|
);
|
|
|
|
$notification = new Notifications(
|
|
|
|
$addressHandler,
|
|
|
|
$server->getHTTPClientService(),
|
2017-04-05 20:35:59 +00:00
|
|
|
$server->query(\OCP\OCS\IDiscoveryService::class),
|
2018-05-04 13:25:02 +00:00
|
|
|
\OC::$server->getJobList(),
|
|
|
|
\OC::$server->getCloudFederationProviderManager(),
|
|
|
|
\OC::$server->getCloudFederationFactory()
|
2016-08-19 10:01:13 +00:00
|
|
|
);
|
|
|
|
return new RequestHandlerController(
|
|
|
|
$c->query('AppName'),
|
|
|
|
$server->getRequest(),
|
|
|
|
$this->getFederatedShareProvider(),
|
|
|
|
$server->getDatabaseConnection(),
|
|
|
|
$server->getShareManager(),
|
|
|
|
$notification,
|
|
|
|
$addressHandler,
|
2017-01-27 11:52:17 +00:00
|
|
|
$server->getUserManager(),
|
2018-04-23 08:44:49 +00:00
|
|
|
$server->getCloudIdManager(),
|
2018-04-30 09:49:24 +00:00
|
|
|
$server->getLogger(),
|
|
|
|
$server->getCloudFederationFactory(),
|
|
|
|
$server->getCloudFederationProviderManager()
|
2016-08-19 10:01:13 +00:00
|
|
|
);
|
|
|
|
});
|
2016-05-23 09:48:14 +00:00
|
|
|
}
|
|
|
|
|
2016-04-18 16:17:08 +00:00
|
|
|
/**
|
|
|
|
* get instance of federated share provider
|
|
|
|
*
|
|
|
|
* @return FederatedShareProvider
|
|
|
|
*/
|
|
|
|
public function getFederatedShareProvider() {
|
|
|
|
if ($this->federatedShareProvider === null) {
|
|
|
|
$this->initFederatedShareProvider();
|
|
|
|
}
|
|
|
|
return $this->federatedShareProvider;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* initialize federated share provider
|
|
|
|
*/
|
|
|
|
protected function initFederatedShareProvider() {
|
2017-05-24 07:07:58 +00:00
|
|
|
$c = $this->getContainer();
|
2016-04-18 16:17:08 +00:00
|
|
|
$addressHandler = new \OCA\FederatedFileSharing\AddressHandler(
|
|
|
|
\OC::$server->getURLGenerator(),
|
2017-01-27 11:52:17 +00:00
|
|
|
\OC::$server->getL10N('federatedfilesharing'),
|
|
|
|
\OC::$server->getCloudIdManager()
|
2016-04-18 16:17:08 +00:00
|
|
|
);
|
|
|
|
$notifications = new \OCA\FederatedFileSharing\Notifications(
|
|
|
|
$addressHandler,
|
|
|
|
\OC::$server->getHTTPClientService(),
|
2017-04-05 20:35:59 +00:00
|
|
|
\OC::$server->query(\OCP\OCS\IDiscoveryService::class),
|
2018-05-04 13:25:02 +00:00
|
|
|
\OC::$server->getJobList(),
|
|
|
|
\OC::$server->getCloudFederationProviderManager(),
|
|
|
|
\OC::$server->getCloudFederationFactory()
|
2016-04-18 16:17:08 +00:00
|
|
|
);
|
|
|
|
$tokenHandler = new \OCA\FederatedFileSharing\TokenHandler(
|
|
|
|
\OC::$server->getSecureRandom()
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->federatedShareProvider = new \OCA\FederatedFileSharing\FederatedShareProvider(
|
|
|
|
\OC::$server->getDatabaseConnection(),
|
|
|
|
$addressHandler,
|
|
|
|
$notifications,
|
|
|
|
$tokenHandler,
|
|
|
|
\OC::$server->getL10N('federatedfilesharing'),
|
|
|
|
\OC::$server->getLogger(),
|
|
|
|
\OC::$server->getLazyRootFolder(),
|
2016-05-11 18:48:27 +00:00
|
|
|
\OC::$server->getConfig(),
|
2017-01-27 11:52:17 +00:00
|
|
|
\OC::$server->getUserManager(),
|
2017-05-24 07:07:58 +00:00
|
|
|
\OC::$server->getCloudIdManager(),
|
2018-06-13 12:19:59 +00:00
|
|
|
$c->query(IConfig::class),
|
|
|
|
\OC::$server->getCloudFederationProviderManager()
|
|
|
|
|
2016-04-18 16:17:08 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|