function thunder_update_8136 in Thunder 8.2
Add permissions to access the tokens overview page.
File
- ./
thunder.install, line 1145 - Install, update and uninstall functions for the thunder installation profile.
Code
function thunder_update_8136() {
/** @var \Drupal\update_helper\Updater $updater */
$updater = \Drupal::service('update_helper.updater');
$updateLogger = $updater
->logger();
$successful = TRUE;
foreach (Role::loadMultiple([
'editor',
'seo',
'restricted_editor',
]) as $role) {
try {
if ($role
->hasPermission('renew token')) {
$role
->grantPermission('access tokens overview');
$role
->save();
$updateLogger
->info(t('Permissions for accessing the tokens overview page is granted for @user_role user role.', [
'@user_role' => $role
->id(),
]));
}
} catch (EntityStorageException $storageException) {
$successful = FALSE;
$updateLogger
->warning(t('Unable to change permissions for @user_role user role.', [
'@user_role' => $role
->id(),
]));
}
}
_thunder_mark_update_checklist('thunder__thunder_update_8136', $successful, $updateLogger);
// Output logged result of update hook execution.
return $updateLogger
->output();
}