I created a new Yii Application using yiic and extended the class SiteController by a new action ‘password’. Finally I want to prevent not logged-in users to use this action.
Therefore I created the following bunch of code (just like the documentation says):
public function filters()
{
return array(
'accessControl',
);
}
public function accessRules()
{
return array(
array('deny',
'actions'=>array('password'),
'users'=>array('?'),
),
);
}
Unfortunately nothing happens. I tried to debug and found out that the ‘filters()’ method is never called during the application lifecycle.
I do have such a function actionPassword(). I understood that in a way that the function accessRules() inside a Controller is responsible for all actionXXX() functions inside that controller.
So what should I do to set rules for the actions of my "SiteController"?