예제 #1
0
<?php

$params = array_merge(require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php');
return ['as access' => ['class' => yii\filters\AccessControl::className(), 'rules' => [['actions' => ['login', 'error'], 'allow' => true, 'roles' => ['?']], ['allow' => true, 'matchCallback' => function ($rule, $action) {
    if (common\models\User::findOne(Yii::$app->user->id)) {
        return common\models\User::findOne(Yii::$app->user->id)->role->name === 'admin';
    }
}]]], 'id' => 'app-backend', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'backend\\controllers', 'bootstrap' => ['log'], 'modules' => [], 'components' => ['request' => ['csrfParam' => '_backendCSRF', 'csrfCookie' => ['httpOnly' => true, 'path' => '/admin']], 'user' => ['identityClass' => 'common\\models\\User', 'enableAutoLogin' => true, 'identityCookie' => ['name' => '_backendIdentity', 'path' => '/admin', 'httpOnly' => true]], 'session' => ['name' => 'BACKENDSESSID', 'cookieParams' => ['path' => '/admin']], 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'errorHandler' => ['errorAction' => 'site/error'], 'urlManager' => ['class' => 'yii\\web\\UrlManager', 'showScriptName' => false, 'enablePrettyUrl' => true, 'rules' => ['<action:(login|logout)>' => 'site/<action>', '<controller:\\w+>/<id:\\d+>' => '<controller>/view', '<controller:\\w+>/<action:\\w+>/<id:\\d+>' => '<controller>/<action>', '<controller:\\w+>/<action:\\w+>' => '<controller>/<action>']]], 'params' => $params];
예제 #2
0
<?php

return ['modelMap' => ['User' => ['class' => 'yiicod\\auth\\models\\UserModel', 'fieldLogin' => 'email', 'fieldEmail' => 'email', 'fieldPassword' => 'password', 'fieldAuthKey' => 'authKey', 'fieldUsername' => 'username', 'fieldPasswordResetToken' => 'passwordResetToken', 'fieldCreatedDate' => 'createdDate', 'fieldUpdatedDate' => 'updatedDate'], 'PasswordResetRequestForm' => ['class' => 'yiicod\\auth\\models\\PasswordResetRequestForm'], 'ResetPasswordForm' => ['class' => 'yiicod\\auth\\models\\ResetPasswordForm'], 'SignupForm' => ['class' => 'yiicod\\auth\\models\\SignupForm'], 'LoginForm' => ['class' => 'yiicod\\auth\\models\\LoginForm']], 'controllers' => ['controllerMap' => ['default' => ['web-user' => 'yiicod\\auth\\controllers\\WebUserController']], 'default' => ['web-user' => ['layout' => '', 'behaviors' => ['access' => ['class' => yii\filters\AccessControl::className(), 'rules' => [['allow' => true, 'actions' => ['login', 'logout', 'requestPasswordReset', 'signup', 'resetPassword']]]], 'authUserBehavior' => ['class' => 'yiicod\\auth\\controllers\\behaviors\\AuthUserBehavior']]]]], 'condition' => []];