Hi,
I want to create an access rule exprenession, using a “Rules” model that I’ve written.
Now, I have a table - Articles. In that rule I want to check if the authenticated user is the owner
of this article. if he is, or if the authenticated user access is 5, the method will return true, and else it returns false.
the method:
public function UpdateArticle($model)
{
if( Yii::app()->user->isGuest )
return false;
if( Yii::app()->user->id === $model->author_id)
return true;
if( Yii::app()->user->auth === 5 )
return true;
return false;
}
Now, how can I pass the $model to this method using controller acess rules?
array('allow',
'actions'=>array('update'),
'expression'=>array('Rules', 'UpdateArticle'),
),
thanks!