RBAC Manager

Hi,

I installed the RBAC manager https://github.com/mdmsoft/yii2-admin and it works great but when I tried to create the menus using the composer command, I got the error below.

Can anyone help me please?


-bash-4.1$ php yii migrate --migrationPath=@yii/rbac/migrations

Exception 'yii\base\UnknownPropertyException' with message 'Getting unknown property: yii\console\ErrorHandler::errorAction'


in /usr/local/development/yiidev/vendor/yiisoft/yii2/base/Component.php:143


Stack trace:

#0 /usr/local/development/yiidev/vendor/mdmsoft/yii2-admin/components/AccessControl.php(106): yii\base\Component->__get('errorAction')

#1 /usr/local/development/yiidev/vendor/yiisoft/yii2/base/ActionFilter.php(67): mdm\admin\components\AccessControl->isActive(Object(yii\base\InlineAction))

#2 [internal function]: yii\base\ActionFilter->beforeFilter(Object(yii\base\ActionEvent))

#3 /usr/local/development/yiidev/vendor/yiisoft/yii2/base/Component.php(538): call_user_func(Array, Object(yii\base\ActionEvent))

#4 /usr/local/development/yiidev/vendor/yiisoft/yii2/base/Module.php(602): yii\base\Component->trigger('beforeAction', Object(yii\base\ActionEvent))

#5 /usr/local/development/yiidev/vendor/yiisoft/yii2/base/Controller.php(139): yii\base\Module->beforeAction(Object(yii\base\InlineAction))

#6 /usr/local/development/yiidev/vendor/yiisoft/yii2/console/Controller.php(91): yii\base\Controller->runAction('', Array)

#7 /usr/local/development/yiidev/vendor/yiisoft/yii2/base/Module.php(455): yii\console\Controller->runAction('', Array)

#8 /usr/local/development/yiidev/vendor/yiisoft/yii2/console/Application.php(161): yii\base\Module->runAction('migrate', Array)

#9 /usr/local/development/yiidev/vendor/yiisoft/yii2/console/Application.php(137): yii\console\Application->runAction('migrate', Array)

#10 /usr/local/development/yiidev/vendor/yiisoft/yii2/base/Application.php(375): yii\console\Application->handleRequest(Object(yii\console\Request))

#11 /usr/local/development/yiidev/yii(31): yii\base\Application->run()

#12 {main}



I already found the solution.

Thanks

I have the same problem,please show your solution

One solution, dont use yii2-admin for console application.

My solution was to comment:

\common\config\main.php




    'as access' => [

        'class' => 'mdm\admin\components\AccessControl',

        'allowActions' => [

            'admin/*', // add or remove allowed actions to this list

			'site/login', 

			'site/error',

        ]

    ],



Hi I find this post with the possible solution.

check github.com the yiisoft/yii2/issues/5141

yii2-admin user component must by set on application config, not in common config.

I add message:

[i]I suppose you got this error when you were trying to migrate or to do something using the console, it is true that Yii add the class automatically in your component configuration and the user is indeed defined as such, but that only applies for applications based on a web\Application.

I also suppose you are using a custom user configuration and you added it to the config files under the common\ folder. Correct me if I am wrong!

Given that common is used by both by the console and the web part of the application, Yii is working correctly but indeed getting an invalid configuration.

Simply moving the user configuration to the config files ones under frontend (or whatever folder contains your web accessible structure) should solve the issue.[/i]

This worked for me too when running from console for the migration