Update AccessRuleFilter to evaluate roleParams

The `roleParams` was not being evaluated earlier and has been included.
This commit is contained in:
Kartik Visweswaran
2017-10-13 23:30:03 +05:30
committed by GitHub
parent 409d6f334c
commit 7cb13457f2

View File

@ -41,8 +41,13 @@ class AccessRuleFilter extends AccessRule
if (!$user->getIsGuest() && $identity->getIsAdmin()) {
return true;
}
} elseif ($user->can($role)) {
return true;
} else {
if (!isset($roleParams)) {
$roleParams = $this->roleParams instanceof Closure ? call_user_func($this->roleParams, $this) : $this->roleParams;
}
if ($user->can($role, $roleParams)) {
return true;
}
}
}