You are here

function opigno_lms_update_8004 in Opigno LMS 8.2

Update content manager permissions.

File

./opigno_lms.install, line 160
Install, update and uninstall functions for the "opigno_lms" installation profile.

Code

function opigno_lms_update_8004() {
  $config_factory = \Drupal::configFactory();
  $config = $config_factory
    ->getEditable('user.role.content_manager');

  // Add new permissions.
  $config_permissions =& $config
    ->get('permissions');
  $issue_permissions = [
    'message all groups',
    'message anyone regardless of groups',
  ];
  foreach ($issue_permissions as $permission) {
    if (!in_array($permission, $config_permissions)) {
      $config_permissions[] = $permission;
    }
  }
  $config
    ->set('permissions', $config_permissions);
  $config
    ->save(TRUE);
}