Search code examples
phpyiiyii-extensions

Yii Error while accessing rights module


I get the following error while accessing the rights module,

 array_map() [<a href='function.array-map'>function.array-map</a>]: Argument #2 should be an array

i have enabled the rights module by adding proper configuration settings in the main.php file

Please can somebody help me out in fixing this issue


Solution

  • It sounds as though your rights are not correctly defined within the controller.

    So when the function goes through what would normally be after position [1] which is actions (since expression, roles and message all go into a different condition as you can see) allowed on the controller is it finding no array there.

    I cannot be more specific about what is really happening without seeing your code but I suspects you have probably tried:

    public function accessRules()
    {
        return array(
            array('allow',
                'actions'=>'*',
                'users'=>array('?'),
            ),
        );
    }
    

    When infact I believe it should be:

    public function accessRules()
    {
        return array(
            array('allow',
                'actions'=>array('*'),
                'users'=>array('?'),
            ),
        );
    }
    

    Hope it helps,