Abstract Class yii\rbac\Rule

继承yii\rbac\Rule » yii\base\BaseObject
实现yii\base\Configurable
可用自版本2.0
源代码 https://github.com/yiisoft/yii2/blob/master/framework/rbac/Rule.php

Rule represents a business constraint that may be associated with a role, permission or assignment.

For more details and usage information on Rule, see the guide article on security authorization.

公共属性

隐藏继承的属性

属性类型描述定义在
$createdAt integer UNIX timestamp representing the rule creation time yii\rbac\Rule
$name string Name of the rule yii\rbac\Rule
$updatedAt integer UNIX timestamp representing the rule updating time yii\rbac\Rule

公共方法

隐藏继承的方法

方法描述定义在
__call() 调用不是类方法的已命名方法. yii\base\BaseObject
__construct() 构造函数. yii\base\BaseObject
__get() 返回对象属性的值. yii\base\BaseObject
__isset() 检查属性是否已设置, 即已定义且不为null. yii\base\BaseObject
__set() 设置对象属性的值. yii\base\BaseObject
__unset() 将对象属性设置为null. yii\base\BaseObject
canGetProperty() 返回一个值, 指示属性是否可读. yii\base\BaseObject
canSetProperty() 返回一个值, 指示属性是否可写. yii\base\BaseObject
className() 返回此类的完全限定名称. yii\base\BaseObject
execute() Executes the rule. yii\rbac\Rule
hasMethod() 返回一个值, 指示方法是否已定义. yii\base\BaseObject
hasProperty() 返回一个值, 指示属性是否已定义. yii\base\BaseObject
init() 初始化对象. yii\base\BaseObject

属性详情

$createdAt public 属性

UNIX timestamp representing the rule creation time

public integer $createdAt null
$name public 属性

Name of the rule

public string $name null
$updatedAt public 属性

UNIX timestamp representing the rule updating time

public integer $updatedAt null

方法详情

execute() public abstract 方法

Executes the rule.

public abstract boolean execute ( $user, $item, $params )
$user string|integer

The user ID. This should be either an integer or a string representing the unique identifier of a user. See yii\web\User::$id.

$item yii\rbac\Item

The role or permission that this rule is associated with

$params array

Parameters passed to yii\rbac\CheckAccessInterface::checkAccess().

return boolean

A value indicating whether the rule permits the auth item it is associated with.