My question is do I have to check access to both ('updateOwnBusiness' or 'updateBusiness'), or should I only have to check for one ('updateOwnBusiness'). I was under the impression that if you have the permission to updateBusiness, then checks for 'updateOwnBusiness' should pass..
$auth->createOperation('createBusiness', 'create a business');
$auth->createOperation('readBusiness', 'read a business');
$auth->createOperation('updateBusiness', 'update a business');
$auth->createOperation('deleteBusiness', 'delete a business');
$bizRule='return Yii::app()->user->id==$params["business"]->owner->email;';
$task=$auth->createTask('updateOwnBusiness', 'update a business by owner himself', $bizRule);
$task->addChild('updateBusiness');
if (Yii::app()->user->checkAccess('updateOwnBusiness', array('business'=>$model)) || Yii::app()->user->checkAccess('updateBusiness'))
{
// update
}

Help
This topic is locked














