From 6dc1b081f9d716af23108fef8efec9ab2cfdf63f Mon Sep 17 00:00:00 2001 From: Arsen Mirzaev Tatyano-Muradovich Date: Mon, 29 Mar 2021 10:20:35 +1000 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=BA=D0=B8=D0=B4=D1=8B=D0=B2?= =?UTF-8?q?=D0=B0=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../skillparts/system/config/web.php.example | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/mirzaev/skillparts/system/config/web.php.example b/mirzaev/skillparts/system/config/web.php.example index 66411fa..d353c18 100644 --- a/mirzaev/skillparts/system/config/web.php.example +++ b/mirzaev/skillparts/system/config/web.php.example @@ -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/' => 'product/index', + 'product/' => 'product/index', + 'product///' => 'product/-', 'orders' => 'order/index' ], ],