Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Specifying Access Rules Specific Error Message In Controller

$
0
0
Hi,

I am currently using yii 1.1.10 version in which I am trying to specify rules specific error message by defining message in accessRules function as specified below:


public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('xxx','yyy'),
'users'=>array('*'),
),
array('allow', // allow all users to perform 'index' and 'view' actions
'message'=>'You must be logged in as Member to perform this action.',
'actions'=>array('zzz','aaa',),
'expression'=>'AuthenticationHelper::isSessionUserAdmin()',
),
array('deny', // deny all users
'users'=>array('*'),
'message' => "This is a generic message.",
),
);
}

However in case expression fails, I am able to view only message that has been specified against deny rule which is "This is a generic message.", even when second evaluation fails. Any points to achieve desired behavior is highly appreciated.

Thanks
Tarun

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>