You are here

function thunder_gqls_install in Thunder 6.2.x

Implements hook_install().

File

modules/thunder_gqls/thunder_gqls.install, line 13
The install file.

Code

function thunder_gqls_install() {
  $graphql_permissions = [
    'execute thunder_graphql arbitrary graphql requests',
    'execute thunder_graphql persisted graphql requests',
  ];
  foreach ([
    'anonymous',
    'authenticated',
  ] as $role) {
    if ($role = Role::load($role)) {
      foreach ($graphql_permissions as $permission) {
        $role
          ->grantPermission($permission);
      }
      $role
        ->save();
    }
  }
}