Commit ce9a8f20 by Qiang Xue

Fixes #3132: `yii\rbac\PhpManager` now supports more compact data file format

parent 65dfedf0
...@@ -9,6 +9,7 @@ Yii Framework 2 Change Log ...@@ -9,6 +9,7 @@ Yii Framework 2 Change Log
- Bug #3128: Fixed the bug that `defaultRoles` set in RBAC manager was not working as specified (qiangxue) - Bug #3128: Fixed the bug that `defaultRoles` set in RBAC manager was not working as specified (qiangxue)
- Enh #3103: debugger panel is now not displayed when printing a page (githubjeka) - Enh #3103: debugger panel is now not displayed when printing a page (githubjeka)
- Enh #3108: Added `yii\debug\Module::enableDebugLogs` to disable logging debug logs by default (qiangxue) - Enh #3108: Added `yii\debug\Module::enableDebugLogs` to disable logging debug logs by default (qiangxue)
- Enh #3132: `yii\rbac\PhpManager` now supports more compact data file format (qiangxue)
- Enh: Added support for using sub-queries when building a DB query with `IN` condition (qiangxue) - Enh: Added support for using sub-queries when building a DB query with `IN` condition (qiangxue)
- Chg: Replaced `clearAll()` and `clearAllAssignments()` in `yii\rbac\ManagerInterface` with `removeAll()`, `removeAllRoles()`, `removeAllPermissions()`, `removeAllRules()` and `removeAllAssignments()` (qiangxue) - Chg: Replaced `clearAll()` and `clearAllAssignments()` in `yii\rbac\ManagerInterface` with `removeAll()`, `removeAllRoles()`, `removeAllPermissions()`, `removeAllRules()` and `removeAllAssignments()` (qiangxue)
......
...@@ -608,11 +608,11 @@ class PhpManager extends BaseManager ...@@ -608,11 +608,11 @@ class PhpManager extends BaseManager
$this->_items[$name] = new $class([ $this->_items[$name] = new $class([
'name' => $name, 'name' => $name,
'description' => $item['description'], 'description' => isset($item['description']) ? $item['description'] : null,
'ruleName' => $item['ruleName'], 'ruleName' => isset($item['ruleName']) ? $item['ruleName'] : null,
'data' => $item['data'], 'data' => isset($item['data']) ? $item['data'] : null,
'createdAt' => isset($item['createdAt']) ? $item['createdAt'] : time(), 'createdAt' => isset($item['createdAt']) ? $item['createdAt'] : null,
'updatedAt' => isset($item['updatedAt']) ? $item['updatedAt'] : time(), 'updatedAt' => isset($item['updatedAt']) ? $item['updatedAt'] : null,
]); ]);
} }
...@@ -629,7 +629,7 @@ class PhpManager extends BaseManager ...@@ -629,7 +629,7 @@ class PhpManager extends BaseManager
$this->_assignments[$userId][$name] = new Assignment([ $this->_assignments[$userId][$name] = new Assignment([
'userId' => $userId, 'userId' => $userId,
'roleName' => $assignment['roleName'], 'roleName' => $assignment['roleName'],
'createdAt' => isset($assignment['createdAt']) ? $assignment['createdAt'] : time(), 'createdAt' => isset($assignment['createdAt']) ? $assignment['createdAt'] : null,
]); ]);
} }
} }
...@@ -651,12 +651,12 @@ class PhpManager extends BaseManager ...@@ -651,12 +651,12 @@ class PhpManager extends BaseManager
$items = []; $items = [];
foreach ($this->_items as $name => $item) { foreach ($this->_items as $name => $item) {
/** @var Item $item */ /** @var Item $item */
$items[$name] = [ $items[$name] = array_filter([
'type' => $item->type, 'type' => $item->type,
'description' => $item->description, 'description' => $item->description,
'ruleName' => $item->ruleName, 'ruleName' => $item->ruleName,
'data' => $item->data, 'data' => $item->data,
]; ]);
if (isset($this->_children[$name])) { if (isset($this->_children[$name])) {
foreach ($this->_children[$name] as $child) { foreach ($this->_children[$name] as $child) {
/** @var Item $child */ /** @var Item $child */
......
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