コード例 #1
0
 protected function beforeAction($action)
 {
     // check that LoginRequired is satified first
     $parentcheck = parent::beforeAction($action);
     if ($parentcheck) {
         // then check if user is activated
         if (!Yii::app()->user->data()->isActivated()) {
             $this->redirect(Yii::t('urls', '/'));
         }
     }
     return $parentcheck;
 }
コード例 #2
0
 /**
  * Rules for CAccessControlFilter.
  *
  * We enable the registration and other basic pages for guest users.
  *
  * @see http://www.yiiframework.com/doc/api/1.1/CController#accessRules-detail
  *
  * @return array Rules for the "accessControl" filter.
  */
 public function accessRules()
 {
     return array_merge([['allow', 'actions' => ['index', 'error']]], parent::accessRules());
 }