Пример #1
0
 /**
  * This method is invoked right before an action is to be executed (after all possible filters.)
  * It checks the existence of the authManager components.
  * @param \yii\base\Action $action the action to be executed.
  * @return boolean whether the action should continue to be executed.
  */
 public function beforeAction($action)
 {
     try {
         if (parent::beforeAction($action)) {
             $this->authManager = Instance::ensure($this->authManager, DbManager::className());
             return true;
         }
     } catch (Exception $e) {
         $this->stderr("ERROR: " . $e->getMessage() . "\n");
     }
     return false;
 }
Пример #2
0
 /**
  * Initialise component.
  */
 public function init()
 {
     parent::init();
     try {
         $this->db = Instance::ensure($this->db, Connection::className());
         if ($this->db->driverName === 'mysql') {
             $this->setTableOptions('CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB');
         }
         $this->authManager = Instance::ensure($this->authManager, DbManager::className());
     } catch (Exception $e) {
         Yii::error([$e->getName(), $e->getMessage()], __METHOD__);
     }
 }
Пример #3
0
<?php

use yii\rbac\DbManager;
return ['id' => 'test', 'basePath' => __DIR__ . '/../', 'controllerMap' => ['migrate' => ['class' => dmstr\console\controllers\MigrateController::class, 'migrationPath' => '@app', 'migrationLookup' => ['@app/../vendor/yiisoft/yii2/rbac/migrations', '@app/../vendor/devgroup/yii2-multilingual/src/migrations', '@app/../vendor/devgroup/yii2-data-structure-tools/src/migrations', '@app/migrations']]], 'components' => ['authManager' => ['class' => DbManager::className()], 'db' => ['class' => yii\db\Connection::class, 'dsn' => 'mysql:host=localhost;dbname=dotplant_monster', 'username' => 'root', 'password' => '', 'charset' => 'utf8'], 'filedb' => ['class' => yii2tech\filedb\Connection::class], 'multilingual' => ['class' => DevGroup\Multilingual\Multilingual::class], 'cache' => ['class' => yii\caching\ArrayCache::class, 'as lazy' => ['class' => DevGroup\TagDependencyHelper\LazyCache::class]], 'monsterCache' => ['class' => 'DotPlant\\Monster\\Cache'], 'monsterRepository' => ['class' => 'DotPlant\\Monster\\Tests\\ExtendedRepository'], 'monsterBh' => ['class' => 'DotPlant\\Monster\\MonsterBh', 'expander' => 'monsterBhExpander'], 'monsterBhExpander' => ['class' => 'DotPlant\\Monster\\MonsterBhExpander']], 'modules' => ['properties' => ['class' => DevGroup\DataStructure\Properties\Module::class, 'searchClass' => DevGroup\DataStructure\search\common\Search::class], 'monster' => ['class' => 'DotPlant\\Monster\\MonsterModule']]];
Пример #4
0
<?php

Yii::setAlias('@tests', dirname(__DIR__) . '/tests');
$params = (require __DIR__ . '/params.php');
if (file_exists(__DIR__ . '/db.php')) {
    $db = (require __DIR__ . '/db.php');
    $config['db'] = $db;
}
return ['id' => 'basic-console', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'controllerNamespace' => 'app\\commands', 'language' => 'ru', 'components' => ['cache' => ['class' => 'yii\\caching\\FileCache'], 'log' => ['targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'db' => isset($db) ? $db : null, 'i18n' => ['translations' => ['app*' => ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => '@app/messages', 'sourceLanguage' => 'ru-RU', 'fileMap' => ['app' => 'app.php', 'app/error' => 'error.php', 'app.console' => 'console.php']]]], 'authManager' => ['class' => \yii\rbac\DbManager::className()]], 'params' => $params];
Пример #5
0
<?php

$params = (require __DIR__ . '/params.php');
$config = ['id' => 'basic', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'language' => 'ru-RU', 'modules' => ['admin' => ['class' => 'app\\modules\\admin\\Module']], 'components' => ['cache' => ['class' => 'yii\\caching\\FileCache'], 'user' => ['identityClass' => 'app\\models\\User', 'enableAutoLogin' => true], 'errorHandler' => ['errorAction' => 'site/error'], 'mail' => ['class' => 'yii\\swiftmailer\\Mailer', 'useFileTransport' => true], 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'db' => require __DIR__ . '/db.php', 'i18n' => ['translations' => ['app*' => ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => '@app/messages', 'sourceLanguage' => 'ru-RU', 'fileMap' => ['app*' => 'app.php']]]], 'formatter' => ['dateFormat' => 'd.m.Y', 'datetimeFormat' => 'd.m.Y H:i:s'], 'authManager' => ['class' => \yii\rbac\DbManager::className()]], 'params' => $params];
if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = 'yii\\debug\\Module';
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = 'yii\\gii\\Module';
}
return $config;
Пример #6
0
 /**
  * Initializes the migration.
  * This method will set [[authManager]] to be the 'authManager' application component, if it is `null`.
  */
 public function init()
 {
     $this->authManager = Instance::ensure($this->authManager, DbManager::className());
     parent::init();
 }
Пример #7
0
<?php

return ['id' => 'crmapp', 'basePath' => realpath(__DIR__ . '/../'), 'bootstrap' => ['debug'], 'components' => ['request' => ['cookieValidationKey' => 'mySecretKey'], 'urlManager' => ['enablePrettyUrl' => true, 'showScriptName' => false], 'db' => require __DIR__ . '/db.php', 'view' => ['renderers' => ['md' => ['class' => 'app\\utilities\\MarkdownRenderer']], 'theme' => ['class' => yii\base\Theme::className(), 'basePath' => '@app/themes/snowy']], 'response' => ['formatters' => ['yaml' => ['class' => 'app\\utilities\\YamlResponseFormatter']]], 'user' => ['identityClass' => 'app\\models\\user\\UserRecord'], 'authManager' => ['class' => \yii\rbac\DbManager::className(), 'defaultRoles' => ['guest']]], 'modules' => ['gii' => ['class' => 'yii\\gii\\Module', 'allowedIPs' => ['*']], 'firstLevel' => ['class' => 'app\\utilities\\FirstModule', 'modules' => ['secondLevel' => ['class' => 'app\\utilities\\SecondModule']]], 'debug' => ['class' => 'yii\\debug\\Module', 'allowedIPs' => ['*']], 'api' => ['class' => 'app\\api\\ApiModule']], 'extensions' => require __DIR__ . '/../vendor/yiisoft/extensions.php'];
Пример #8
0
<?php

return ['id' => 'crmapp-console', 'basePath' => dirname(__DIR__), 'components' => ['db' => require __DIR__ . '/db.php', 'authManager' => ['class' => \yii\rbac\DbManager::className(), 'defaultRoles' => ['guest']]]];