Can someone provide an example of using expression in accessRules ?
Thanks
Can someone provide an example of using expression in accessRules ?
Thanks
In a rule, you can set its 'expression' as follows,
'expression'=>PHP expression
If the expression evaluates true, this rule applies.
Hi qiang
I tried using this:
'expression'=>$user->role->name=='editor'
where role is mapped to user with relation
but it throws error that 2nd argument must be array
when it is changed to array($user->role->name=='editor')
…it doesn't throw error but it doesn't work still.
please provide an example if possible.
There's a bug which has been fixed in SVN.
The expression must be given as a string (not a value). For example:
<?php 'expression'=>'!$user->isGuest && $user->role->name=="editor"'