Thursday, 18 December 2014

Expression in Access Rules in YII

Here is one of the way on how we do control user access to some function in our controller.
In your controller file, on public function accessRules(), add this array:
array('allow',
                                'actions'=>array('leaveApproval', 'pendingLeave'),
                                'users'=>array(Yii::app()->user->username),
                                'expression' => '(Yii::app()->user->leave_approval == "Y")',
                        ),

No comments:

Post a Comment