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' ], ],