You are here

function social_book_update_8001 in Open Social 10.2.x

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

Enable book page creation permissions for CM and SM.

File

modules/social_features/social_book/social_book.install, line 102
Install, update and uninstall functions for the social_book module.

Code

function social_book_update_8001() {
  $roles = Role::loadMultiple();
  $permissions = [
    'create new books',
    'add content to books',
    'create book content',
    'delete any book content',
    'delete own book content',
    'delete book revisions',
    'revert book revisions',
    'edit any book content',
    'edit own book content',
    'view book revisions',
  ];

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