'basic', 'name'=>'Antares-2000', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'language' => 'ru-RU', //'defaultRoute' => 'main/index', 'aliases' => [ '@bower' => '@vendor/bower-asset', '@npm' => '@vendor/npm-asset', ], 'components' => [ 'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 'cookieValidationKey' => '9F0UJBZKPPoUsJAKuAh9hpvyWdaF1IIb', 'parsers' => [ 'application/json' => 'yii\web\JsonParser', ] ], 'cache' => [ 'class' => 'yii\caching\FileCache', ], 'user' => [ 'class' => 'app\components\User', 'loginUrl' => ['login'], //'returnUrl' => ['home'], 'identityClass' => 'app\models\user\User', ], 'errorHandler' => [ 'errorAction' => 'site/error', ], 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', // send all mails to a file by default. You have to set // 'useFileTransport' to false and configure a transport // for the mailer to send real emails. //'useFileTransport' => false, 'transport' => [ 'class' => 'Swift_SmtpTransport', 'host' => $_ENV['SMTP_HOST'], 'username' => $_ENV['SMTP_LOGIN'], 'password' => $_ENV['SMTP_PASS'], 'port' => $_ENV['SMTP_PORT'], 'encryption' => $_ENV['SMTP_ENC'], ], ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], ], ], 'db' => $db, 'urlManager' => [ 'enablePrettyUrl' => true, 'enableStrictParsing' => true, 'showScriptName' => false, 'rules' => [ [ 'class' => 'yii\rest\UrlRule', 'controller' => ['api/user'], 'extraPatterns' => [ 'POST add' => 'bulk-add', ], ], '/' => 'site/index', 'pricing/' => 'pricing/', //'user/admin/' => 'user/admin/', 'user//' => 'user//', /*'/' => '/', '/' => '/', '//' => '/',*/ //'login' => 'user/security/login', '' => 'user/security/', //'' => 'user/security/', //'api/' => 'api/', //'api//' => 'api/' ], ], 'i18n' => [ 'translations' => [ 'app' => [ 'class' => 'yii\i18n\PhpMessageSource', 'basePath' => '@app/messages', 'sourceLanguage' => 'en', 'fileMap' => [ 'app' => 'app.php', ], ], 'user' => [ 'class' => 'yii\i18n\PhpMessageSource', 'basePath' => '@app/messages', 'on missingTranslation' => ['app\components\TranslationEventHandler', 'handleMissingTranslation'] ], ], ], 'view' => [ 'theme' => [ 'pathMap' => [ '@dektrium/user/views' => '@app/views/user' ], ], ], 'assetManager' => [ 'bundles' => [ 'yii\bootstrap\BootstrapPluginAsset' => [ 'js'=>[] ], 'yii\bootstrap\BootstrapAsset' => [ 'css' => [], ], ], ], ], 'modules' => [ 'user' => [ 'class' => 'dektrium\user\Module', 'enableRegistration' => false, 'enablePasswordRecovery' => false, 'enableConfirmation' => false, 'adminPermission' => 'admin', //'admins' => ['ptenchik0'], 'rememberFor' => 86400, /*'modelMap' => [ //'RecoveryForm' => 'app\models\security\RecoveryForm', //'RegistrationForm' => 'app\models\security\RegistrationForm', 'User' => 'app\models\user\User', 'UserSearch' => 'app\models\search\Users', 'LoginForm' => 'app\models\security\LoginForm', //'Profile' => 'app\models\user\Profile', //'SettingsForm' => 'app\models\user\SettingsForm', ],*/ ], 'api' => [ 'class' => 'app\modules\api\Module', ], ], 'params' => $params, 'on beforeAction' => function ($event) { if (Yii::$app->user->isGuest) Yii::$app->layout = 'guest'; }, 'as globalAccess' => [ 'class' => app\components\GlobalAccessBehavior::class, 'rules' => [ [ 'actions' => ['error'], 'allow' => true, 'roles' => ["?","@"], ], [ 'actions' => ['login'], 'allow' => true, 'roles' => ['?'], ], [ 'actions' => ['logout'], 'allow' => true, 'roles' => ['@'], ], [ 'controllers' => ['api/user'], 'allow' => true, 'roles' => ['?'], ], [ 'controllers' => ['user/admin'], 'allow' => true, 'roles' => ['admin'], ], [ 'controllers' => ['user/admin'], 'allow' => false, ], [ 'allow' => true, 'roles' => ['client', 'admin'], ], // [ // 'controllers' => ['sign-in'], // 'allow' => true, // 'roles' => ['?'], // 'actions' => ['login'], // ], // [ // 'controllers' => ['sign-in'], // 'allow' => true, // 'roles' => ['@'], // 'actions' => ['logout'], // ], // [ // 'controllers' => ['site'], // 'allow' => true, // 'roles' => ['?', '@'], // 'actions' => ['error'], // ], // [ // 'controllers' => ['debug/default'], // 'allow' => true, // 'roles' => ['?'], // ], // [ // 'controllers' => ['user'], // 'allow' => true, // 'roles' => ['administrator'], // ], // [ // 'controllers' => ['user'], // 'allow' => false, // ], // [ // 'allow' => true, // 'roles' => ['manager', 'administrator'], // ], ], ], ]; if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = [ 'class' => 'yii\debug\Module', // uncomment the following to add your IP if you are not connecting from localhost. //'allowedIPs' => ['127.0.0.1', '::1'], ]; $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', // uncomment the following to add your IP if you are not connecting from localhost. //'allowedIPs' => ['127.0.0.1', '::1'], ]; } return $config;