#[Package('core')]
class Migration1625304609UpdateRolePrivileges extends MigrationStep
{ public function getCreationTimestamp(): int
{ return 1625304609;
} public function update(Connection
$connection): void
{ $appNames =
$this->
getAllApps($connection);
$privileges =
$this->
getAppPrivileges($appNames);
$roles =
$connection->
fetchAllAssociative( 'SELECT * from `acl_role` WHERE `id` IN (SELECT DISTINCT `acl_role_id` FROM `acl_user_role`)',
);
$updatedAt =
(new \
DateTimeImmutable())->
format(Defaults::STORAGE_DATE_FORMAT
);
foreach ($roles as $role) { $currentPrivileges =
json_decode((string) $role['privileges'
], true, 512, \JSON_THROW_ON_ERROR
);
$currentPrivileges =
array_merge($currentPrivileges,
$privileges);
$currentPrivileges =
array_unique($currentPrivileges);