Докидываю
This commit is contained in:
parent
3fea918255
commit
6dc1b081f9
|
@ -21,9 +21,12 @@ $config = [
|
||||||
'user' => [
|
'user' => [
|
||||||
'identityClass' => 'app\models\Account',
|
'identityClass' => 'app\models\Account',
|
||||||
'loginUrl' => ['/authentication'],
|
'loginUrl' => ['/authentication'],
|
||||||
'enableAutoLogin' => true,
|
// 'enableAutoLogin' => true,
|
||||||
'enableSession' => true
|
'enableSession' => true
|
||||||
],
|
],
|
||||||
|
'authManager' => [
|
||||||
|
'class' => 'mirzaev\yii2\arangodb\rbac\DbManager',
|
||||||
|
],
|
||||||
'session' => [
|
'session' => [
|
||||||
'class' => 'mirzaev\yii2\arangodb\sessions\ArangoDbSession',
|
'class' => 'mirzaev\yii2\arangodb\sessions\ArangoDbSession',
|
||||||
'document' => 'session',
|
'document' => 'session',
|
||||||
|
@ -31,14 +34,18 @@ $config = [
|
||||||
// 'lifetime' => 3600 * 24 * 30 * 12
|
// 'lifetime' => 3600 * 24 * 30 * 12
|
||||||
'lifetime' => 3600 * 24 * 3
|
'lifetime' => 3600 * 24 * 3
|
||||||
],
|
],
|
||||||
'writeCallback' => function($session) {
|
'writeCallback' => function($session): array {
|
||||||
return [
|
// Инициализация
|
||||||
'account' => Yii::$app->user->id,
|
$data = [];
|
||||||
'ip' => yii::$app->request->userIP
|
|
||||||
];
|
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,
|
'timeout' => 3600 * 24 * 3,
|
||||||
'useCookies' => true,
|
'useStrictMode' => false,
|
||||||
|
'useCookies' => true
|
||||||
],
|
],
|
||||||
'errorHandler' => [
|
'errorHandler' => [
|
||||||
'errorAction' => 'error',
|
'errorAction' => 'error',
|
||||||
|
@ -68,7 +75,8 @@ $config = [
|
||||||
'class' => 'yii\rest\UrlRule',
|
'class' => 'yii\rest\UrlRule',
|
||||||
'controller' => 'main'
|
'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'
|
'orders' => 'order/index'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
Reference in New Issue