Added REST admin controller

This commit is contained in:
MatteoF96
2022-09-22 16:06:44 +02:00
parent b680784f66
commit ced062856f
8 changed files with 547 additions and 2 deletions

View File

@ -53,6 +53,7 @@ class Bootstrap implements BootstrapInterface
if ($app instanceof WebApplication) {
$this->initControllerNamespace($app);
$this->initUrlRoutes($app);
$this->initUrlRestRoutes($app);
$this->initAuthCollection($app);
$this->initAuthManager($app);
} else {
@ -277,6 +278,25 @@ class Bootstrap implements BootstrapInterface
$app->getUrlManager()->addRules([$rule], false);
}
/**
* Initializes web url for rest routes.
* @param WebApplication $app
* @throws InvalidConfigException
*/
protected function initUrlRestRoutes(WebApplication $app)
{
/** @var Module $module */
$module = $app->getModule('user');
$rules = $module->adminRestRoutes;
$config = [
'class' => 'yii\web\GroupUrlRule',
'prefix' => $module->adminRestPrefix,
'rules' => $rules,
];
$rule = Yii::createObject($config);
$app->getUrlManager()->addRules([$rule], false);
}
/**
* Ensures required mail parameters needed for the mail service.
*