yii2 mogodb RBAC configuration

自闭症网瘾萝莉.ら 提交于 2020-01-30 10:59:25

问题


I have installed yii2 mongodb extension, I am able to create mongodb collection, model etc.

I have also installed https://github.com/imanilchaudhari/yii2-mongodb-admin, but there are no docs, how to configure the same. but it contains some hints, which I am not able to make out like

GUI manager for RBAC.

Use [[\yii\base\Module::$controllerMap]] to change property of controller. To change listed menu, use property [[$menus]].

'layout' => 'left-menu', // default to null mean use application layout.
'controllerMap' => [
    'assignment' => [
        'class' => 'imanilchaudhari\mongodb\admin\controllers\AssignmentController',
        'userClassName' => 'app\models\User',
        'idField' => 'id'
    ]
],
'menus' => [
    'assignment' => [
        'label' => 'Grand Access' // change label
    ],
    'route' => null, // disable menu
],

I also tried to add in components section of config/web.php like

'authManager' => [
            'class' => 'yii\mongodb\rbac\MongoDbManager ',
            'defaultRoles' => ['guest'],
        ],

and just to check I added in site/about controller like:

public function actionAbout()
    {
        if(Yii::$app->user->can('view'))
        {
        return $this->render('about');
        }
    }

and I am getting the error like:

Failed to instantiate component or class "yii\mongodb\rbac\MongoDbManager ".

anyone who has configured this module or otherwise help me implement it.

来源:https://stackoverflow.com/questions/59897322/yii2-mogodb-rbac-configuration

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!