Докидываю

This commit is contained in:
Arsen Mirzaev Tatyano-Muradovich 2021-03-29 10:20:35 +10:00
parent 3fea918255
commit 6dc1b081f9

View File

@ -21,9 +21,12 @@ $config = [
'user' => [
'identityClass' => 'app\models\Account',
'loginUrl' => ['/authentication'],
'enableAutoLogin' => true,
// 'enableAutoLogin' => true,
'enableSession' => true
],
'authManager' => [
'class' => 'mirzaev\yii2\arangodb\rbac\DbManager',
],
'session' => [
'class' => 'mirzaev\yii2\arangodb\sessions\ArangoDbSession',
'document' => 'session',
@ -31,14 +34,18 @@ $config = [
// 'lifetime' => 3600 * 24 * 30 * 12
'lifetime' => 3600 * 24 * 3
],
'writeCallback' => function($session) {
return [
'account' => Yii::$app->user->id,
'ip' => yii::$app->request->userIP
];
'writeCallback' => function($session): array {
// Инициализация
$data = [];
yii::$app->request->userIP and $data['ip'] = yii::$app->request->userIP;
Yii::$app->user->id and $data['account'] = Yii::$app->user->id;
return $data ?? [];
},
'timeout' => 3600 * 24 * 3,
'useCookies' => true,
'useStrictMode' => false,
'useCookies' => true
],
'errorHandler' => [
'errorAction' => 'error',
@ -68,7 +75,8 @@ $config = [
'class' => 'yii\rest\UrlRule',
'controller' => 'main'
],
'product/<id:\d+>' => 'product/index',
'product/<catn:[^/]+>' => 'product/index',
'product/<catn:[^/]+>/<action:(write|edit|delete)>/<target:(title|catn|desc|image)>' => 'product/<action>-<target>',
'orders' => 'order/index'
],
],