Commit 66842a48 by Qiang Xue

Fixes test break.

parent 14b782cf
...@@ -65,8 +65,8 @@ class AccessControl extends ActionFilter ...@@ -65,8 +65,8 @@ class AccessControl extends ActionFilter
* function ($rule, $action) * function ($rule, $action)
* ~~~ * ~~~
* *
* where `$rule` is this rule, and `$action` is the current [[Action|action]] object. * where `$rule` is the rule that denies the user, and `$action` is the current [[Action|action]] object.
* `$rule` will be `null` if access is denied because none of the rules matched. * `$rule` can be `null` if access is denied because none of the rules matched.
*/ */
public $denyCallback; public $denyCallback;
/** /**
......
...@@ -190,19 +190,21 @@ abstract class BaseManager extends Component implements ManagerInterface ...@@ -190,19 +190,21 @@ abstract class BaseManager extends Component implements ManagerInterface
* If the item does not specify a rule, this method will return true. Otherwise, it will * If the item does not specify a rule, this method will return true. Otherwise, it will
* return the value of [[Rule::execute()]]. * return the value of [[Rule::execute()]].
* *
* @param string|integer $user the user ID. This should be either an integer or a string representing
* the unique identifier of a user. See [[\yii\web\User::id]].
* @param Item $item the auth item that needs to execute its rule * @param Item $item the auth item that needs to execute its rule
* @param array $params parameters passed to [[ManagerInterface::checkAccess()]] and will be passed to the rule * @param array $params parameters passed to [[ManagerInterface::checkAccess()]] and will be passed to the rule
* @return boolean the return value of [[Rule::execute()]]. If the auth item does not specify a rule, true will be returned. * @return boolean the return value of [[Rule::execute()]]. If the auth item does not specify a rule, true will be returned.
* @throws InvalidConfigException if the auth item has an invalid rule. * @throws InvalidConfigException if the auth item has an invalid rule.
*/ */
protected function executeRule($item, $params) protected function executeRule($user, $item, $params)
{ {
if ($item->ruleName === null) { if ($item->ruleName === null) {
return true; return true;
} }
$rule = $this->getRule($item->ruleName); $rule = $this->getRule($item->ruleName);
if ($rule instanceof Rule) { if ($rule instanceof Rule) {
return $rule->execute($item, $params); return $rule->execute($user, $item, $params);
} else { } else {
throw new InvalidConfigException("Rule not found: {$item->ruleName}"); throw new InvalidConfigException("Rule not found: {$item->ruleName}");
} }
......
...@@ -35,8 +35,8 @@ abstract class Rule extends Object ...@@ -35,8 +35,8 @@ abstract class Rule extends Object
* *
* @param string|integer $user the user ID. This should be either an integer or a string representing * @param string|integer $user the user ID. This should be either an integer or a string representing
* the unique identifier of a user. See [[\yii\web\User::id]]. * the unique identifier of a user. See [[\yii\web\User::id]].
* @param Item $item the auth item that this rule is associated with * @param Item $item the role or permission that this rule is associated with
* @param array $params parameters passed to [[ManagerInterface::allow()]]. * @param array $params parameters passed to [[ManagerInterface::checkAccess()]].
* @return boolean a value indicating whether the rule permits the auth item it is associated with. * @return boolean a value indicating whether the rule permits the auth item it is associated with.
*/ */
abstract public function execute($user, $item, $params); abstract public function execute($user, $item, $params);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment