delay middleware registrations
This commit is contained in:
parent
adff34cb8a
commit
57f37c876b
|
@ -40,6 +40,10 @@ use OCP\IServerContainer;
|
||||||
|
|
||||||
class DIContainer extends SimpleContainer implements IAppContainer{
|
class DIContainer extends SimpleContainer implements IAppContainer{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $middleWares;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put your class dependencies in here
|
* Put your class dependencies in here
|
||||||
|
@ -89,6 +93,10 @@ class DIContainer extends SimpleContainer implements IAppContainer{
|
||||||
$dispatcher = new MiddlewareDispatcher();
|
$dispatcher = new MiddlewareDispatcher();
|
||||||
$dispatcher->registerMiddleware($c['SecurityMiddleware']);
|
$dispatcher->registerMiddleware($c['SecurityMiddleware']);
|
||||||
|
|
||||||
|
foreach($this->middleWares as $middleWare) {
|
||||||
|
$dispatcher->registerMiddleware($middleWare);
|
||||||
|
}
|
||||||
|
|
||||||
return $dispatcher;
|
return $dispatcher;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -125,10 +133,7 @@ class DIContainer extends SimpleContainer implements IAppContainer{
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function registerMiddleWare(IMiddleWare $middleWare) {
|
function registerMiddleWare(IMiddleWare $middleWare) {
|
||||||
/** @var $dispatcher MiddlewareDispatcher */
|
array_push($this->middleWares, $middleWare);
|
||||||
$dispatcher = $this->query('MiddlewareDispatcher');
|
|
||||||
$dispatcher->registerMiddleware($middleWare);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue