Class yeesoft\behaviors\AccessFilter

Inheritanceyeesoft\behaviors\AccessFilter » yii\base\ActionFilter

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$denyCallback callable A callback that will be called if the access should be denied to the current user. yeesoft\behaviors\AccessFilter

Public Methods

Hide inherited methods

MethodDescriptionDefined By
beforeAction() Check if user has access to current route yeesoft\behaviors\AccessFilter

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
denyAccess() Denies the access of the user. yeesoft\behaviors\AccessFilter

Property Details

$denyCallback public property

A callback that will be called if the access should be denied to the current user. If not set, denyAccess() will be called.

The signature of the callback should be as follows:

function ($rule, $action)

where $rule is the rule that denies the user, and $action is the current \Action object. $rule can be null if access is denied because none of the rules matched.

public callable $denyCallback null

Method Details

beforeAction() public method

Check if user has access to current route

public boolean beforeAction ( $action )
$action \yii\base\Action

The action to be executed.

return boolean

Whether the action should continue to be executed.

denyAccess() protected method

Denies the access of the user.

The default implementation will redirect the user to the login page if he is a guest; if the user is already logged, a 403 HTTP exception will be thrown.

protected void denyAccess ( )
throws \yii\web\ForbiddenHttpException

if the user is already logged in.