簡體   English   中英

Yii - 允許通過身份驗證的用戶訪問所有控制器中的每個操作

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM