Merge pull request #17569 from nextcloud/td/di/middleware
Allow DI in middleware
This commit is contained in:
commit
07dffb6df6
2 changed files with 2 additions and 9 deletions
|
@ -127,13 +127,6 @@ class Application extends App {
|
|||
);
|
||||
});
|
||||
|
||||
$container->registerService('OCSShareAPIMiddleware', function (SimpleContainer $c) use ($server) {
|
||||
return new OCSShareAPIMiddleware(
|
||||
$server->getShareManager(),
|
||||
$server->getL10N($c->query('AppName'))
|
||||
);
|
||||
});
|
||||
|
||||
$container->registerService(ShareInfoMiddleware::class, function () use ($server) {
|
||||
return new ShareInfoMiddleware(
|
||||
$server->getShareManager()
|
||||
|
@ -142,7 +135,7 @@ class Application extends App {
|
|||
|
||||
// Execute middlewares
|
||||
$container->registerMiddleWare('SharingCheckMiddleware');
|
||||
$container->registerMiddleWare('OCSShareAPIMiddleware');
|
||||
$container->registerMiddleWare(OCSShareAPIMiddleware::class);
|
||||
$container->registerMiddleWare(ShareInfoMiddleware::class);
|
||||
|
||||
$container->registerService('MountProvider', function (IContainer $c) {
|
||||
|
|
|
@ -279,7 +279,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
);
|
||||
|
||||
foreach($this->middleWares as $middleWare) {
|
||||
$dispatcher->registerMiddleware($c[$middleWare]);
|
||||
$dispatcher->registerMiddleware($c->query($middleWare));
|
||||
}
|
||||
|
||||
$dispatcher->registerMiddleware(
|
||||
|
|
Loading…
Reference in a new issue