kinross
- kinross 赞了回复
规则表:[auth_rule]
一个用户要执行一个操作除了要看他有没有这个权限外,还要看他的这个权限能不能执行。
在上面的 表:auth_item 中还有一个字段: [rule_name] 。这个字段用来标明这个角色或者权限能不能成功执行。
那么规则这个表里面的数据是从哪里来的呢?
下面这个是规则的基类:abstract class Rule extends Object
{/** * @var string name of the rule */ public $name; /** * @var integer UNIX timestamp representing the rule creation time */ public $createdAt; /** * @var integer UNIX timestamp representing the rule updating time */ public $updatedAt; /** * Executes the rule. * * @param Item $item the auth item that this rule is associated with * @param array $params parameters passed to [[ManagerInterface::allow()]]. * @return boolean a value indicating whether the rule permits the auth item it is associated with. */ abstract public function execute($item, $params);
}
$name 为规则的名称。
也就是说如果要在 规则表:[auth_rule] 中增加一条规则就得要有对应的规则类,并实现方法 abstract public function execute($item, $params) 具体的逻辑来判定$item(角色或者权限)是否可执行。 - kinross 2020-05-28 已签到连续签到2天,获得了10个金钱
- kinross 2020-05-27 已签到连续签到1天,获得了5个金钱
- kinross 2020-05-25 已签到连续签到1天,获得了5个金钱
- kinross 2020-05-21 已签到连续签到3天,获得了15个金钱
- kinross 2020-05-20 已签到连续签到2天,获得了10个金钱
- kinross 2020-05-19 已签到连续签到1天,获得了5个金钱
- kinross 2020-05-14 已签到连续签到4天,获得了20个金钱