function profile_update_8002 in Profile 8
Updates view profile permission name.
File
- ./
profile.install, line 61 - Install, update and uninstall functions for the profile module.
Code
function profile_update_8002() {
/** @var \Drupal\user\Entity\Role[] $roles */
$roles = Role::loadMultiple();
foreach ($roles as $role) {
if ($role
->hasPermission('view profile')) {
$role
->revokePermission('view profile');
$role
->grantPermission('view own profile');
$role
->save();
}
}
return t('Permission name updated.');
}