Esempio n. 1
0
 /** @inheritdoc */
 public function bootstrap($app)
 {
     // register translations
     if (!isset($app->get('i18n')->translations['rbac*'])) {
         $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 dektrium/user extension is installed, copy admin list from there
         if ($this->checkUserModuleInstalled($app)) {
             $app->getModule('rbac')->admins = $app->getModule('user')->admins;
         }
     }
 }
Esempio n. 2
0
 /** @inheritdoc */
 public function bootstrap($app)
 {
     // register translations
     if (!isset($app->get('i18n')->translations['rbac*'])) {
         $app->get('i18n')->translations['rbac*'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => __DIR__ . '/messages'];
     }
     if ($this->checkRbacModuleInstalled($app)) {
         $authManager = $app->get('authManager', false);
         if (!$authManager) {
             $app->set('authManager', ['class' => DbManager::className()]);
         } else {
             if (!$authManager instanceof ManagerInterface) {
                 throw new InvalidConfigException('You have wrong authManager configuration');
             }
         }
         // if dektrium/user extension is installed, copy admin list from there
         if ($this->checkUserModuleInstalled($app) && $app instanceof WebApplication) {
             $app->getModule('rbac')->admins = $app->getModule('user')->admins;
         }
     }
 }
Esempio n. 3
0
 /**
  * This method will set [[authManager]] to be the 'authManager' application component, if it is `null`.
  */
 public function init()
 {
     parent::init();
     $this->authManager = Instance::ensure($this->authManager, DbManager::className());
 }