/** @inheritdoc */
 public function bootstrap($app)
 {
     /** @var $module Module */
     if ($app->hasModule('user') && ($module = $app->getModule('user')) instanceof Module) {
         $this->_modelMap = array_merge($this->_modelMap, $module->modelMap);
         foreach ($this->_modelMap as $name => $definition) {
             $class = "matacms\\user\\models\\" . $name;
             \Yii::$container->set($class, $definition);
             $modelName = is_array($definition) ? $definition['class'] : $definition;
             $module->modelMap[$name] = $modelName;
             if (in_array($name, ['User', 'Profile', 'Token', 'Account'])) {
                 \Yii::$container->set($name . 'Query', function () use($modelName) {
                     return $modelName::find();
                 });
             }
         }
         \Yii::$container->setSingleton(Finder::className(), ['userQuery' => \Yii::$container->get('UserQuery'), 'profileQuery' => \Yii::$container->get('ProfileQuery'), 'tokenQuery' => \Yii::$container->get('TokenQuery'), 'accountQuery' => \Yii::$container->get('AccountQuery')]);
         if ($app instanceof ConsoleApplication) {
             $module->controllerNamespace = 'matacms\\user\\commands';
         } else {
             \Yii::$container->set('yii\\web\\User', ['enableAutoLogin' => true, 'loginUrl' => ['/user/security/login'], 'identityClass' => $module->modelMap['User']]);
             $configUrlRule = ['prefix' => $module->urlPrefix, 'rules' => $module->urlRules];
             if ($module->urlPrefix != 'user') {
                 $configUrlRule['routePrefix'] = 'user';
             }
             $app->get('urlManager')->rules[] = new GroupUrlRule($configUrlRule);
             if (!$app->has('authClientCollection')) {
                 $app->set('authClientCollection', ['class' => Collection::className()]);
             }
         }
         $app->get('i18n')->translations['user*'] = ['class' => PhpMessageSource::className(), 'basePath' => __DIR__ . '/messages'];
         $defaults = ['welcomeSubject' => \Yii::t('user', 'Welcome to {0}', \Yii::$app->name), 'confirmationSubject' => \Yii::t('user', 'Confirm account on {0}', \Yii::$app->name), 'reconfirmationSubject' => \Yii::t('user', 'Confirm email change on {0}', \Yii::$app->name), 'recoverySubject' => \Yii::t('user', 'Complete password reset on {0}', \Yii::$app->name), 'passwordChangedSubject' => \Yii::t('user', 'Your password has been changed on {0}', \Yii::$app->name)];
         \Yii::$container->set('matacms\\user\\Mailer', array_merge($defaults, $module->mailer));
     }
     Event::on(ActiveField::className(), ActiveField::EVENT_INIT_DONE, function (MessageEvent $event) {
         $event->getMessage()->attachBehavior('moduleAccessibility', new ModuleAccessibilityActiveFormBehavior());
     });
     Event::on(AdminController::class, Controller::EVENT_MODEL_UPDATED, function (\matacms\base\MessageEvent $event) {
         $this->processSave($event->getMessage());
     });
     Event::on(AdminController::class, Controller::EVENT_MODEL_CREATED, function (\matacms\base\MessageEvent $event) {
         $this->processSave($event->getMessage());
     });
 }
 /** @inheritdoc */
 public function bootstrap($app)
 {
     // register translations
     $app->get('i18n')->translations['rbac*'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => __DIR__ . '/messages'];
     if ($this->checkRbacModuleInstalled($app)) {
         // register auth manager
         if (!$this->checkAuthManagerConfigured($app)) {
             $app->set('authManager', ['class' => DbManager::className()]);
         }
         // if matacms/matacms-user extension is installed, copy admin list from there
         if ($this->checkUserModuleInstalled($app)) {
             $app->getModule('rbac')->admins = $app->getModule('user')->admins;
         }
     }
     Event::on(ActiveField::className(), ActiveField::EVENT_INIT_DONE, function (MessageEvent $event) {
         $event->getMessage()->attachBehavior('roleAssignments', new RoleAssignmentActiveFormBehavior());
     });
     Event::on(AdminController::class, Controller::EVENT_MODEL_UPDATED, function (\matacms\base\MessageEvent $event) {
         $this->processSave($event->getMessage());
     });
     Event::on(AdminController::class, Controller::EVENT_MODEL_CREATED, function (\matacms\base\MessageEvent $event) {
         $this->processSave($event->getMessage());
     });
 }