You are here

function opigno_ilt_install in Opigno Instructor-led Trainings 8

Same name and namespace in other branches
  1. 3.x opigno_ilt.install \opigno_ilt_install()

Implements hook_install().

File

./opigno_ilt.install, line 19
Install, update and uninstall functions for the Opigno ILT module.

Code

function opigno_ilt_install() {
  if (!\Drupal::isConfigSyncing()) {

    // Allow users to view ILT entities.
    $role = Role::load(RoleInterface::AUTHENTICATED_ID);
    $role
      ->grantPermission('view ilt entities');
    $role
      ->save();

    // Allow platform-level student managers to score ILT entities.
    $role = Role::load('user_manager');
    $role
      ->grantPermission('score ilt entities');
    $role
      ->save();

    // Allow group-level student managers to score ILT entities.
    $role = GroupRole::load('learning_path-user_manager');
    $role
      ->grantPermission('score ilt entities');
    $role
      ->save();
  }
}