![](/img/trans.png)
[英]Yii2 Dektrium User, make login required for all actions and all controllers
[英]Yii - Allow access to every actions in all controllers to authenticated user
我的項目中有很多操作,我不想在訪問規則中寫入所有操作名稱。 我正在組件內部的控制器中編寫我的訪問規則。 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'),
);
}
還有很多動作,我不想寫每一個
提前致謝
只需省略此處所述的規則中的actions
部分
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.