-
Notifications
You must be signed in to change notification settings - Fork 586
Description
Hello. in the authorization controller, I can log in. but when i go to another page my user is not authorized
Yii::$app->user->identity === null => true
`<?php
$params = require DIR . '/params.php';
$db = require DIR . '/db.php';
$config = [
'id' => 'basic',
'basePath' => dirname(DIR),
'bootstrap' => ['log'],
'language' => 'ru',
'modules' => [
'rbac' => [
'class' => 'mdm\admin\Module',
'layout' => '@app/views/layouts/rbac.php',
'controllerMap' => [
'assignment' => [
'class' => 'app\controllers\rbac\AssignmentController',
'idField' => 'id',
'usernameField' => 'username'
],
'route' => ['class' => 'app\controllers\rbac\RouteController'],
'permission' => ['class' => 'app\controllers\rbac\PermissionController'],
'role' => ['class' => 'app\controllers\rbac\RoleController'],
'user' => ['class' => 'app\controllers\rbac\UserController']
]
],
'admin' => [
'class' => 'app\modules\admin\Module',
'layout' => 'admin.php'
]
],
'container' => [
'definitions' => [
\yii\widgets\LinkPager::class => \yii\bootstrap4\LinkPager::class,
]
],
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'as access' => [
'class' => 'mdm\admin\components\AccessControl',
'allowActions' => [
'site/*',
]
],
'components' => [
'authManager' => [
'class' => 'yii\rbac\DbManager'
],
'i18n' => [
'translations' => [
'rbac-admin' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@mdm/admin/messages',
'sourceLanguage' => 'ru'
]
]
],
'formatter' => [
'class' => 'yii\i18n\Formatter',
'locale' => 'ru-RU',
'defaultTimeZone' => 'Europe/Moscow',
'timeZone' => 'GMT+3',
'dateFormat' => 'd MMMM Y',
'datetimeFormat' => 'HH:i:s d/M/Y',
'timeFormat' => 'HH:i:s',
],
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => '_CQG_7Mqoxt5uxULlmM4xW-JlJQcW-pB',
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'user' => [
'identityClass' => 'mdm\admin\models\User',
'loginUrl' => ['rbac/user/login'],
'enableSession' => true,
],
'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' => 'smtp.yandex.ru',
'port' => '465',
'encryption' => 'ssl',
]
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'db' => $db,
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
],
],
'reCaptcha' => [
'name' => 'reCaptcha',
'class' => 'himiklab\yii2\recaptcha\ReCaptchaConfig',
'siteKeyV3' => '6Leo6XYgAAAAAIS7dLs0o0VC9zRsVLNYsXr6VTUA',
'secretV3' => '6Leo6XYgAAAAAOQckqI_qmKUI5EtEa0QDxKiGQ8A',
],
],
'params' => $params,
];
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['as access']['allowActions'] = [
'site/*',
'callback/*',
'rbac/*',
// 'admin/',
// 'gii/',
// 'direction/*'
];
$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;`