Skip to content

Commit

Permalink
Merge dd3b637 into 085121c
Browse files Browse the repository at this point in the history
  • Loading branch information
basakest committed Sep 4, 2021
2 parents 085121c + dd3b637 commit 1e502e9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Adapter.php
Expand Up @@ -37,9 +37,9 @@ public function __construct()

public function savePolicyLine($ptype, array $rule)
{
$col['`ptype`'] = $ptype;
$col['ptype'] = $ptype;
foreach ($rule as $key => $value) {
$col['`v'.strval($key).'`'] = $value;
$col['v' . strval($key)] = $value;
}

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

foreach ($rules as $rule) {
$temp['`ptype`'] = $ptype;
$temp['ptype'] = $ptype;
foreach ($rule as $key => $value) {
$temp['`v'. strval($key) . '`'] = $value;
$temp['v' . strval($key)] = $value;
}
$cols[$i++] = $temp ?? [];
$cols[] = $temp;
$temp = [];
}
$entities = $this->table->newEntities($cols);
Expand Down

0 comments on commit 1e502e9

Please sign in to comment.