Rbac如何控制菜单显示

大家好,我在项目中使用了Yii中的rbac去控制权限.

但是checkAccess的方法,好像只能在controller中使用,我的主菜单中的链接有好几个controller的action.

这样我就无法对菜单中的链接进行权限判断了.

大家有没有别的方法?

你是想根据不同的角色来隐藏菜单里面的选项吧。

这个是rights module里面代码,可做参考:




array('label'=>'Rights', 'url'=>array('/rights'), 'visible'=>Yii::app()->user->checkAccess(Rights::module()->superuserName))



自己写个