mdmsoft / yii2-admin

Auth manager for Yii2 (RBAC Manager)
GNU General Public License v3.0
1.16k stars 574 forks source link

Installation on yii2 app advanced #205

Closed fedemotta closed 8 years ago

fedemotta commented 9 years ago

Hi, I am using version 3.

When you try to install this extension in the yii2 app advanced using DbManager the following exception raises in the migration command:

Exception 'yii\base\InvalidConfigException' with message 'You should configure "authManager" component to use database before executing this migration.'

I am adding all the configuration in the backend/config/main.php (because it is where I need to use it) but the console has a different config file. That is why the error raises. I moved this configuration to the common config file.

My question is: I need to setup the yii2 admin configuration in the console for some reason I didn't understand (perhaps a security problem about the configuration)? Or this exception is a bug and this check should not be made?

Thanks!

GaboGit commented 8 years ago

In config.php you should add/change the component properties to USE database: 'components' => [ ......

    'authManager' => [
        'class' => 'yii\rbac\DbManager',
    ],
fedemotta commented 8 years ago

@GaboGit I know that. I already added it. My question is: Why this authManager configuration should be added in the console application? I didn't need it there, but the migration ask for it.

GaboGit commented 8 years ago

You need that config to run the proper migration process. The migration process is a console php script that write the required database modifications in db. You have to tell yii2 console environment that you are using Auth dbmanager to do this

fedemotta commented 8 years ago

I know what a migration is and the purpose of this migration. Again, my question is: Why this check is done in the console application? It generates the need of this dependency in the console application for this check only! On Sep 26, 2015 6:04 PM, "GaboGit" notifications@github.com wrote:

You need that config to run the proper migration process. The migration process is a console php script that write the required database modifications in db. You have to tell yii2 console environment that you are using Auth dbmanager to do this

— Reply to this email directly or view it on GitHub https://github.com/mdmsoft/yii2-admin/issues/205#issuecomment-143495669.

fedemotta commented 8 years ago

Investigating this issue further I found that the possible bug is in the yii2 core