protected function addAdditionalPrivileges(Connection
$connection, array
$privileges): void
{ $roles =
$connection->
iterateAssociative('SELECT * from `acl_role`'
);
try { $connection->
beginTransaction();
/** @var array<string, mixed> $role */
foreach ($roles as $role) { $currentPrivileges = \
json_decode((string) $role['privileges'
], true, 512, \JSON_THROW_ON_ERROR
);
$newPrivileges =
$this->
fixRolePrivileges($privileges,
$currentPrivileges);
if ($currentPrivileges ===
$newPrivileges) { continue;
} $role['privileges'
] = \
json_encode($newPrivileges, \JSON_THROW_ON_ERROR
);
$role['updated_at'
] =
(new \
DateTimeImmutable())->
format(Defaults::STORAGE_DATE_FORMAT
);
$connection->
update('acl_role',
$role,
['id' =>
$role['id'
]]);
}