0

I've created a small module some week ago, now I need to work with this module but when i open the module link I have got redirect to login page, the module no have behaviors defined, if i don't mistake this let full access at all user, for test I've set on main module controller this behavior

public function behaviors(){
    return [
        'access' => [
            'class' => AccessControl::className(),
            'rules' => [
                [
                    'actions' => ['*'],
                    'allow' => true,
                ]
            ]
        ]
    ];
}

but the application redirect me to login page. How i can allow access to all users? Thanks

MarBer
  • 535
  • 1
  • 5
  • 22

1 Answers1

0

If you don't need access control, you should simply remove the behavior.

Or use this :

public function behaviors(){
    return [
        'access' => [
            'class' => AccessControl::className(),
            'rules' => [
                [
                    'allow' => true,
                ]
            ]
        ]
    ];
}

About AccessRule::$actions :

List of action IDs that this rule applies to. The comparison is case-sensitive. If not set or empty, it means this rule applies to all actions.

soju
  • 25,111
  • 3
  • 68
  • 70
  • Thanks now work fine but the first time i've no behaviors defined and have been redirected to login, the second thing i've made is write the behavior for all actions with `'actions' => ['*']`, I don't understand why this rule has no the same effect like yours – MarBer Jul 11 '16 at 13:56