Fix creating the share controller

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2020-04-15 14:06:23 +02:00 committed by Roeland Jago Douma
parent 708b4991d9
commit e45c87cd2e
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 3 additions and 70 deletions

View File

@ -80,48 +80,10 @@ class Application extends App {
$mountProviderCollection = $server->getMountProviderCollection();
$notifications = $server->getNotificationManager();
/**
* Controllers
*/
$container->registerService('ShareController', function (SimpleContainer $c) use ($server) {
$federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application();
return new ShareController(
$c->query('AppName'),
$c->query('Request'),
$server->getConfig(),
$server->getURLGenerator(),
$server->getUserManager(),
$server->getLogger(),
$server->getActivityManager(),
$server->getShareManager(),
$server->getSession(),
$server->getPreviewManager(),
$server->getRootFolder(),
$federatedSharingApp->getFederatedShareProvider(),
$server->getEventDispatcher(),
$server->getL10N($c->query('AppName')),
$server->query(Defaults::class)
);
});
$container->registerService('ExternalSharesController', function (SimpleContainer $c) {
return new ExternalSharesController(
$c->query('AppName'),
$c->query('Request'),
$c->query('ExternalManager'),
$c->query('HttpClientService')
);
});
/**
* Core class wrappers
*/
$container->registerService('HttpClientService', function (SimpleContainer $c) use ($server) {
return $server->getHTTPClientService();
});
$container->registerService(ICloudIdManager::class, function (SimpleContainer $c) use ($server) {
return $server->getCloudIdManager();
});
$container->registerService('ExternalManager', function (SimpleContainer $c) use ($server) {
$container->registerService(Manager::class, function (SimpleContainer $c) use ($server) {
$user = $server->getUserSession()->getUser();
$uid = $user ? $user->getUID() : null;
return new \OCA\Files_Sharing\External\Manager(
@ -138,43 +100,14 @@ class Application extends App {
$uid
);
});
$container->registerAlias(Manager::class, 'ExternalManager');
/**
* Middleware
*/
$container->registerService('SharingCheckMiddleware', function (SimpleContainer $c) use ($server) {
return new SharingCheckMiddleware(
$c->query('AppName'),
$server->getConfig(),
$server->getAppManager(),
$server->query(IControllerMethodReflector::class),
$server->getShareManager(),
$server->getRequest()
);
});
$container->registerService(ShareInfoMiddleware::class, function () use ($server) {
return new ShareInfoMiddleware(
$server->getShareManager()
);
});
// Execute middlewares
$container->registerMiddleWare('SharingCheckMiddleware');
$container->registerMiddleWare(SharingCheckMiddleware::class);
$container->registerMiddleWare(OCSShareAPIMiddleware::class);
$container->registerMiddleWare(ShareInfoMiddleware::class);
$container->registerService('MountProvider', function (IContainer $c) {
/** @var \OCP\IServerContainer $server */
$server = $c->query('ServerContainer');
return new MountProvider(
$server->getConfig(),
$server->getShareManager(),
$server->getLogger()
);
});
$container->registerService('ExternalMountProvider', function (IContainer $c) {
/** @var \OCP\IServerContainer $server */
$server = $c->query('ServerContainer');
@ -205,7 +138,7 @@ class Application extends App {
}
protected function registerMountProviders(IMountProviderCollection $mountProviderCollection) {
$mountProviderCollection->registerProvider($this->getContainer()->query('MountProvider'));
$mountProviderCollection->registerProvider($this->getContainer()->query(MountProvider::class));
$mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider'));
}