Commit effafbc1 authored by Fabian de Rijk's avatar Fabian de Rijk
Browse files

Issue #3272675 by fabianderijk: Cannot create groups with "local" user

parent dd106708
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -49,6 +49,10 @@ function o365_groups_entity_base_field_info(EntityTypeInterface $entity_type) {
 */
function o365_groups_form_group_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if (isset($form['field_o365_groups_teams_id'])) {
    /** @var \Drupal\o365\GraphService $graphService */
    $graphService = \Drupal::service('o365.graph');

    if ($graphService && $graphService->getCurrentUserId()) {
      /** @var \Drupal\o365_groups\GroupsService $groupsService */
      $groupsService = \Drupal::service('o365_groups.groups');
      $availableTeams = $groupsService->getGroupsFromTeams();
@@ -60,6 +64,10 @@ function o365_groups_form_group_form_alter(&$form, FormStateInterface $form_stat
        $form['field_o365_groups_teams_id']['#access'] = FALSE;
      }
    }
    else {
      $form['field_o365_groups_teams_id']['#access'] = FALSE;
    }
  }
}

/**