You are here

public function TeamInvitationQueryAccessSubscriber::onQueryAccess in Apigee Edge 8

Modifies the access conditions for team_invitation.

Parameters

\Drupal\entity\QueryAccess\QueryAccessEvent $event: The event.

File

modules/apigee_edge_teams/src/EventSubscriber/TeamInvitationQueryAccessSubscriber.php, line 64

Class

TeamInvitationQueryAccessSubscriber
Subscribes to query access events for team_invitation.

Namespace

Drupal\apigee_edge_teams\EventSubscriber

Code

public function onQueryAccess(QueryAccessEvent $event) {

  // Add a condition to check for a valid team.
  // We query team from storage instead of check for a null team field because
  // the team might have been deleted on the remote server.
  $team_ids = array_keys($this->entityTypeManager
    ->getStorage('team')
    ->loadMultiple());
  $event
    ->getConditions()
    ->addCondition('team', $team_ids);
}