PHP 클래스 yii\filters\AccessRule

부터: 2.0
저자: Qiang Xue ([email protected])
상속: extends yii\base\Component
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$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