我想将此代码添加到应用程序配置中,我是从 link 获取的。
return [
'modules' => [
'admin' => [
'class' => 'mdm\admin\Module',
...
]
...
],
...
'components' => [
...
'authManager' => [
'class' => 'yii\rbac\PhpManager', // or use 'yii\rbac\DbManager'
]
],
'as access' => [
'class' => 'mdm\admin\components\AccessControl',
'allowActions' => [
'site/*',
'admin/*',
'some-controller/some-action',
// The actions listed here will be allowed to everyone including guests.
// So, 'admin/*' should not appear here in the production, of course.
// But in the earlier stages of your development, you may probably want to
// add a lot of actions here until you finally completed setting up rbac,
// otherwise you may not even take a first step.
]
],];
但该文件位于何处? 我正在使用Yii2 Advanced模板。
答案 0 :(得分:0)
您必须在配置主文件中添加此文件,该文件位于后端和前端(取决于您的要求)。
在后端
Path : backend/config/main.php
并在前端
Path : frontend/config/main.php
您必须在各个组件中添加所有配置设置