framework/filters/AccessControl.php
public function beforeAction($action)
    {
        $user = $this->user;
        $request = Yii::$app->getRequest();
        /* @var $rule AccessRule */
        foreach ($this->rules as $rule) {
            if ($allow = $rule->allows($action, $user, $request)) {
                return true;
            } elseif ($allow === false) {
                if (isset($rule->denyCallback)) {
                    call_user_func($rule->denyCallback, $rule, $action);
                } elseif ($this->denyCallback !== null) {
                    call_user_func($this->denyCallback, $rule, $action);
                } else {
                    $this->denyAccess($user);
                }

                return false;
            }
        }
        if ($this->denyCallback !== null) {
            call_user_func($this->denyCallback, null, $action);
        } else {
            $this->denyAccess($user);
        }

        return false;
    }
public function beforeAction($action)
    {
        $user = $this->user;
        $request = Yii::$app->getRequest();
        /* @var $rule AccessRule */
        foreach ($this->rules as $rule) {
            if ($allow = $rule->allows($action, $user, $request)) {
                return true;
            } elseif ($allow === false) {
                if (isset($rule->denyCallback)) {
                    call_user_func($rule->denyCallback, $rule, $action);
                } elseif ($this->denyCallback !== null) {
                    call_user_func($this->denyCallback, $rule, $action);
                } else {
                    $this->denyAccess($user);
                }

                return false;
            }
        }
        if ($this->denyCallback !== null) {
            call_user_func($this->denyCallback, null, $action);
        } else {
            $this->denyAccess($user);
        }

        return false;
    }
public function beforeAction ( $ action ) { $ user = $ this -> user ; $ request = Yii :: $ app -> getRequest ( ) ; /* @var $rule AccessRule */ foreach ( $ this -> rules as $ rule ) { if ( $ allow = $ rule -> allows ( $ action , $ user , $ request ) ) { return true ; } elseif ( $ allow === false ) { if ( isset ( $ rule -> denyCallback ) ) { call_user_func ( $ rule -> denyCallback , $ rule , $ action ) ; } elseif ( $ this -> denyCallback !== null ) { call_user_func ( $ this -> denyCallback , $ rule , $ action ) ; } else { $ this -> denyAccess ( $ user ) ; } return false ; } } if ( $ this -> denyCallback !== null ) { call_user_func ( $ this -> denyCallback , null , $ action ) ; } else { $ this -> denyAccess ( $ user ) ; } return false ; }
This method is invoked right before an action is to be executed (after all possible filters.)
You may override this method to do last-minute preparation for the action.
@param Action $action the action to be executed.
@return bool whether the action should continue to be executed.
This method is invoked right before an action is to be executed ( after all possible filters . ) You may override this method to do last - minute preparation for the action .