mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 05:48:11 +08:00
Fixes #17341: Allow callable objects to be set to \yii\filters\AccessRule::$roleParams
This commit is contained in:
committed by
Alexander Makarov
parent
0165416c79
commit
a226b76776
@ -9,6 +9,7 @@ Yii Framework 2 Change Log
|
||||
- Enh #17345: Improved performance of `yii\db\Connection::quoteColumnName()` (brandonkelly)
|
||||
- Enh #17348: Improved performance of `yii\db\Connection::quoteTableName()` (brandonkelly)
|
||||
- Enh #17353: Added `sameSite` support for `yii\web\Cookie` and `yii\web\Session::cookieParams` (rhertogh)
|
||||
- Bug #17341: Allow callable objects to be set to `\yii\filters\AccessRule::$roleParams` (alexkart)
|
||||
|
||||
|
||||
2.0.20 June 04, 2019
|
||||
|
||||
@ -240,7 +240,7 @@ class AccessRule extends Component
|
||||
}
|
||||
} else {
|
||||
if (!isset($roleParams)) {
|
||||
$roleParams = $this->roleParams instanceof Closure ? call_user_func($this->roleParams, $this) : $this->roleParams;
|
||||
$roleParams = !is_array($this->roleParams) && is_callable($this->roleParams) ? call_user_func($this->roleParams, $this) : $this->roleParams;
|
||||
}
|
||||
if ($user->can($item, $roleParams)) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user