Skip to content

Commit 9b635f2

Browse files
committed
fix: Use loadPolicyArray instead of loadPolicyLine
1 parent 03492ae commit 9b635f2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/adapter/DatabaseAdapter.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,9 @@ public function savePolicyLine($ptype, array $rule)
8888
*/
8989
public function loadPolicy(Model $model): void
9090
{
91-
$rows = $this->model->cache('tauthz')->select()->toArray();
91+
$rows = $this->model->cache('tauthz')->field(['ptype', 'v0', 'v1', 'v2', 'v3', 'v4', 'v5'])->select()->toArray();
9292
foreach ($rows as $row) {
93-
$line = implode(', ', array_filter(array_slice($row, 1), function ($val) {
94-
return '' != $val && !is_null($val);
95-
}));
96-
$this->loadPolicyLine(trim($line), $model);
93+
$this->loadPolicyArray($this->filterRule($row), $model);
9794
}
9895
}
9996

0 commit comments

Comments
 (0)