Hi,
I have an accessRules which validates for access Rights for each user using the following syntax defined in the method of each controller. Now i have many controllers, so i have to define this expression( ‘expression’ => ‘Yii::app()->controller->isValidAccess()’,) in every controller inorder to place access restriction for all the actions.
Is there any ways i can define this expression in base controller i.e (components/controller.php), so that i dont have to paste this expression in all my controllers.
Note: ‘Yii::app()->controller->isValidAccess()’ ---- exists in components/controller.php
/* expression defined in all my controllers */
public function accessRules() {
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions' => array('update','admin','create'),
//'users' => array('@'),
'expression' => 'Yii::app()->controller->isValidAccess()',
),
);
}