You are here

function social_profile_update_8004 in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_profile/social_profile.install \social_profile_update_8004()
  2. 8 modules/social_features/social_profile/social_profile.install \social_profile_update_8004()
  3. 8.2 modules/social_features/social_profile/social_profile.install \social_profile_update_8004()
  4. 8.3 modules/social_features/social_profile/social_profile.install \social_profile_update_8004()
  5. 8.4 modules/social_features/social_profile/social_profile.install \social_profile_update_8004()
  6. 8.5 modules/social_features/social_profile/social_profile.install \social_profile_update_8004()
  7. 8.6 modules/social_features/social_profile/social_profile.install \social_profile_update_8004()
  8. 8.7 modules/social_features/social_profile/social_profile.install \social_profile_update_8004()
  9. 10.3.x modules/social_features/social_profile/social_profile.install \social_profile_update_8004()
  10. 10.0.x modules/social_features/social_profile/social_profile.install \social_profile_update_8004()
  11. 10.1.x modules/social_features/social_profile/social_profile.install \social_profile_update_8004()
  12. 10.2.x modules/social_features/social_profile/social_profile.install \social_profile_update_8004()

Add edit own and edit any profile permissions after update to Profile beta1.

File

modules/social_features/social_profile/social_profile.install, line 206
Install, update and uninstall functions for the social_profile module.

Code

function social_profile_update_8004(&$sandbox) {
  $roles = Role::loadMultiple();
  $lu_permissions = [
    'update own profile profile',
  ];
  $cm_permissions = [
    'update any profile profile',
  ];

  /** @var \Drupal\user\Entity\Role $role */
  foreach ($roles as $role) {
    if ($role
      ->id() === 'authenticated') {
      user_role_grant_permissions($role
        ->id(), $lu_permissions);
    }
    if ($role
      ->id() === 'contentmanager' || $role
      ->id() === 'sitemanager') {
      user_role_grant_permissions($role
        ->id(), $cm_permissions);
    }
  }
}