yiisoft/yii — pull request #402 by luislobo (2012-02-25 05:13:50+00:00)
Title: Added deniedCallback to CAccessControlFilter and CAccessRule to allow forwarding control to a method on denial

Issue #294

Added deniedCallback to CAccessControlFilter and CAccessRule to allow forwarding control to a method on denial.

This allows you to have access rules defined like this:

public function accessRules()
{
return array(
array( 'allow',
'users' => array( '@' ),
),
array( 'deny', // deny all non authenticated users
'deniedCallback' => 'redirectToLogin',
'users' => array( '*' ),
),
);
}

public function redirectToLogin()
{
$this->redirect('/site/login');
}