You are here

protected function QueryAccessHandler::buildEntityOwnerConditions in Entity API 8

Builds the conditions for entities that have an owner.

Parameters

string $operation: The access operation. Usually one of "view", "update", "duplicate", or "delete".

\Drupal\Core\Session\AccountInterface $account: The user for which to restrict access.

Return value

\Drupal\entity\QueryAccess\ConditionGroup|null The conditions, or NULL if the user doesn't have access to any entity.

Overrides QueryAccessHandlerBase::buildEntityOwnerConditions

File

src/QueryAccess/QueryAccessHandler.php, line 18

Class

QueryAccessHandler
Controls query access based on the generic entity permissions.

Namespace

Drupal\entity\QueryAccess

Code

protected function buildEntityOwnerConditions($operation, AccountInterface $account) {
  if ($operation == 'view') {

    // EntityPermissionProvider doesn't provide own/any view permissions.
    return $this
      ->buildEntityConditions($operation, $account);
  }
  return parent::buildEntityOwnerConditions($operation, $account);
}