Skip to content

Commit dd3b637

Browse files
committed
fix: addPolicies, savePolicyLine cannot adds policy rules to database
1 parent 085121c commit dd3b637

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Adapter.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public function __construct()
3737

3838
public function savePolicyLine($ptype, array $rule)
3939
{
40-
$col['`ptype`'] = $ptype;
40+
$col['ptype'] = $ptype;
4141
foreach ($rule as $key => $value) {
42-
$col['`v'.strval($key).'`'] = $value;
42+
$col['v' . strval($key)] = $value;
4343
}
4444

4545
$entity = $this->table->newEntity($col);
@@ -107,14 +107,13 @@ public function removeFilteredPolicy($sec, $ptype, $fieldIndex, ...$fieldValues)
107107
public function addPolicies(string $sec, string $ptype, array $rules): void
108108
{
109109
$cols = [];
110-
$i = 0;
111110

112111
foreach ($rules as $rule) {
113-
$temp['`ptype`'] = $ptype;
112+
$temp['ptype'] = $ptype;
114113
foreach ($rule as $key => $value) {
115-
$temp['`v'. strval($key) . '`'] = $value;
114+
$temp['v' . strval($key)] = $value;
116115
}
117-
$cols[$i++] = $temp ?? [];
116+
$cols[] = $temp;
118117
$temp = [];
119118
}
120119
$entities = $this->table->newEntities($cols);

0 commit comments

Comments
 (0)