PHP Класс yii\filters\AccessRule

С версии: 2.0
Автор: Qiang Xue ([email protected])
Наследование: extends yii\base\Component
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$actions list of action IDs that this rule applies to. The comparison is case-sensitive. If not set or empty, it means this rule applies to all actions.
$allow whether this is an 'allow' rule or 'deny' rule.
$controllers list of the controller IDs that this rule applies to. Each controller ID is prefixed with the module ID (if any). The comparison is case-sensitive. If not set or empty, it means this rule applies to all controllers.
$denyCallback a callback that will be called if this rule determines the access to the current action should be denied. If not set, the behavior will be determined by AccessControl. The signature of the callback should be as follows: php function ($rule, $action) where $rule is this rule, and $action is the current [[Action|action]] object.
$ips list of user IP addresses that this rule applies to. An IP address can contain the wildcard * at the end so that it matches IP addresses with the same prefix. For example, '192.168.*' matches all IP addresses in the segment '192.168.'. If not set or empty, it means this rule applies to all IP addresses.
$matchCallback a callback that will be called to determine if the rule should be applied. The signature of the callback should be as follows: php function ($rule, $action) where $rule is this rule, and $action is the current [[Action|action]] object. The callback should return a boolean value indicating whether this rule should be applied.
$roles list of roles that this rule applies to. Two special roles are recognized, and they are checked via [[User::isGuest]]: - ?: matches a guest user (not authenticated yet) - @: matches an authenticated user If you are using RBAC (Role-Based Access Control), you may also specify role or permission names. In this case, [[User::can()]] will be called to check access. If this property is not set or empty, it means this rule applies to all roles.
$verbs list of request methods (e.g. GET, POST) that this rule applies to. If not set or empty, it means this rule applies to all request methods.

Открытые методы

Метод Описание
allows ( Action $action, User $user, Request $request ) : boolean | null Checks whether the Web user is allowed to perform the specified action.

Защищенные методы

Метод Описание
matchAction ( Action $action ) : boolean
matchController ( Controller $controller ) : boolean
matchCustom ( Action $action ) : boolean
matchIP ( string $ip ) : boolean
matchRole ( User $user ) : boolean
matchVerb ( string $verb ) : boolean

Описание методов

allows() публичный Метод

Checks whether the Web user is allowed to perform the specified action.
public allows ( Action $action, User $user, Request $request ) : boolean | null
$action yii\base\Action the action to be performed
$user yii\web\User the user object
$request yii\web\Request
Результат boolean | null true if the user is allowed, false if the user is denied, null if the rule does not apply to the user

matchAction() защищенный Метод

protected matchAction ( Action $action ) : boolean
$action yii\base\Action the action
Результат boolean whether the rule applies to the action

matchController() защищенный Метод

protected matchController ( Controller $controller ) : boolean
$controller yii\base\Controller the controller
Результат boolean whether the rule applies to the controller

matchCustom() защищенный Метод

protected matchCustom ( Action $action ) : boolean
$action yii\base\Action the action to be performed
Результат boolean whether the rule should be applied

matchIP() защищенный Метод

protected matchIP ( string $ip ) : boolean
$ip string the IP address
Результат boolean whether the rule applies to the IP address

matchRole() защищенный Метод

protected matchRole ( User $user ) : boolean
$user yii\web\User the user object
Результат boolean whether the rule applies to the role

matchVerb() защищенный Метод

protected matchVerb ( string $verb ) : boolean
$verb string the request method.
Результат boolean whether the rule applies to the request

Описание свойств

$actions публичное свойство

list of action IDs that this rule applies to. The comparison is case-sensitive. If not set or empty, it means this rule applies to all actions.
public $actions

$allow публичное свойство

whether this is an 'allow' rule or 'deny' rule.
public $allow

$controllers публичное свойство

list of the controller IDs that this rule applies to. Each controller ID is prefixed with the module ID (if any). The comparison is case-sensitive. If not set or empty, it means this rule applies to all controllers.
public $controllers

$denyCallback публичное свойство

a callback that will be called if this rule determines the access to the current action should be denied. If not set, the behavior will be determined by AccessControl. The signature of the callback should be as follows: php function ($rule, $action) where $rule is this rule, and $action is the current [[Action|action]] object.
public $denyCallback

$ips публичное свойство

list of user IP addresses that this rule applies to. An IP address can contain the wildcard * at the end so that it matches IP addresses with the same prefix. For example, '192.168.*' matches all IP addresses in the segment '192.168.'. If not set or empty, it means this rule applies to all IP addresses.
См. также: Request::userIP
public $ips

$matchCallback публичное свойство

a callback that will be called to determine if the rule should be applied. The signature of the callback should be as follows: php function ($rule, $action) where $rule is this rule, and $action is the current [[Action|action]] object. The callback should return a boolean value indicating whether this rule should be applied.
public $matchCallback

$roles публичное свойство

list of roles that this rule applies to. Two special roles are recognized, and they are checked via [[User::isGuest]]: - ?: matches a guest user (not authenticated yet) - @: matches an authenticated user If you are using RBAC (Role-Based Access Control), you may also specify role or permission names. In this case, [[User::can()]] will be called to check access. If this property is not set or empty, it means this rule applies to all roles.
public $roles

$verbs публичное свойство

list of request methods (e.g. GET, POST) that this rule applies to. If not set or empty, it means this rule applies to all request methods.
См. также: yii\web\Request::method
public $verbs