You are here

public function QueryAccessHandlerBase::getConditions in Group 2.0.x

Same name and namespace in other branches
  1. 8 src/Entity/Access/QueryAccessHandlerBase.php \Drupal\group\Entity\Access\QueryAccessHandlerBase::getConditions()

File

src/Entity/Access/QueryAccessHandlerBase.php, line 83

Class

QueryAccessHandlerBase
Controls query access for the Group module's entities.

Namespace

Drupal\group\Entity\Access

Code

public function getConditions($operation, AccountInterface $account = NULL) {
  $account = $account ?: $this->currentUser;
  $entity_type_id = $this->entityType
    ->id();
  $conditions = $this
    ->buildConditions($operation, $account);

  // Allow other modules to modify the conditions before they are used.
  $event = new QueryAccessEvent($conditions, $operation, $account, $entity_type_id);
  $this->eventDispatcher
    ->dispatch("entity.query_access", $event);
  $this->eventDispatcher
    ->dispatch("entity.query_access.{$entity_type_id}", $event);
  return $conditions;
}