【发布时间】:2014-08-11 14:40:41
【问题描述】:
我的项目中有很多动作,我不想在访问规则中写下所有动作名称。我正在组件内部的控制器中编写访问规则。 Yii 中是否有任何方法可以让我在用户通过身份验证后授予对所有操作的访问权限?类似于操作的通配符?
例如
public function accessRules()
{
return array(
array(
'allow',
'actions'=>array('login'),
'users'=>array('*'),
),
array(
'allow',
'actions'=>array('changepassword','logout',
'searchstudent','searchstudentlist','registration','editstudent','undodelete',
'edit','leftschool','removestudent','deletestudent','undodeletestudent','undoleftstudent'),
'users'=>array('@'),
),
array('deny'),
);
}
还有很多动作,我不想每一个都写
提前致谢
【问题讨论】: