安装yii2-rbac错误您的authManager配置错误

时间:2017-10-08 14:54:10

标签: yii2 composer-php yii2-rbac

我在此网站页面后安装yii2-rbac:https://github.com/dektrium/yii2-rbac/blob/master/docs/installation.md。 我第二次这样做。我第一次完成,但是我在config / web.php文件中写道:

'modules' => [
    'user' => [
        'class' => 'dektrium\user\Module',
    ],
    //'rbac' => 'dektrium\rbac\RbacWebModule',
    'rbac' => 'dektrium\rbac\RbacConsoleModule',

],

我不知道,'rbac'=> 'dektrium \ rbac \ RbacConsoleModule'它必须在console.php中写入(不在web.php中)。

'authManager'  => [
        'class'        => 'yii\rbac\DbManager',
        //'defaultRoles' => ['guest'],
    ],

` 这个代码我在两个配置文件中都写过:web.php和console.php,但是在web.php中我写了'rbac'=> 'dektrium \ rbac \ RbacConsoleModule'和console.php我还没写过,但一切正常:yii2-rbac已经安装成功。并且所有交易都顺利通过。但'rbac'=> web.php中的'dektrium \ rbac \ RbacConsoleModule'在我看来是错的。它不是Web模块,它是控制台模块。然后我有回滚事务(迁移/关闭),我已经删除了composer.json“dektrium / yii2-rbac”:“1.0.0-alpha@dev”声明,从而删除了rbac。一切都被删除了。 比我第二次开始安装rbac。在作曲家安装之后,我在web.php中写道:

'modules' => [
    'user' => [
        'class' => 'dektrium\user\Module',
    ],
    'rbac' => 'dektrium\rbac\RbacWebModule',
    //'rbac' => 'dektrium\rbac\RbacConsoleModule',

],

并在console.php中写道:

'modules' => [

    'rbac' => 'dektrium\rbac\RbacConsoleModule',

],

yii2上的网站在它之后不起作用!!!我在web.php“... RbacConsoleModule”中进行了更改。网站工作。为什么它不适用于RbacWebModule?然后我尝试应用之前已经回滚的事务,但是引发了错误:你的authManager配置错误了 enter image description here

我该怎么办?帮我。因为我的英语而感到愤怒。我来自俄罗斯。

我的console.php:

$config = [
'id' => 'basic-console',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'app\commands',
'components' => [
    'cache' => [
        'class' => 'yii\caching\FileCache',
    ],
    'log' => [
        'targets' => [
            [
                'class' => 'yii\log\FileTarget',
                'levels' => ['error', 'warning'],
            ],
        ],
    ],
    'db' => $db,

    'authManager'  => [
        'class'        => 'yii\rbac\DbManager',
        //'defaultRoles' => ['guest'],
    ]
],

'modules' => [

    'rbac' => 'dektrium\rbac\RbacConsoleModule',

],

// ...

我的web.php:

    //This all in $component

    'db' => require(__DIR__ . '/db.php'),


    'authManager'  => [
        'class'        => 'yii\rbac\DbManager',
        //'defaultRoles' => ['guest'],
    ],

],

'modules' => [
    'user' => [
        'class' => 'dektrium\user\Module',
    ],
    //'rbac' => 'dektrium\rbac\RbacWebModule',
    'rbac' => 'dektrium\rbac\RbacConsoleModule',

],

1 个答案:

答案 0 :(得分:2)

那一切!问题已经确定。它必须将authManager部分写入模块,而不是组件:

In [3167]: df.fillna({c: df.close.shift() for c in df}).ffill()
Out[3167]:
                          open       high        low      close
Timestamp
2014-01-07 13:18:00  874.67040  892.06753  874.67040  892.06753
2014-01-07 13:19:00  892.06753  892.06753  892.06753  892.06753
2014-01-07 13:20:00  892.06753  892.06753  892.06753  892.06753
2014-01-07 13:21:00  883.23085  883.23085  874.48165  874.48165
2014-01-07 13:22:00  874.48165  874.48165  874.48165  874.48165