You are here

protected function SearchApiFieldTrait::checkEntityAccess in Search API 8

Checks whether the searching user has access to the given value.

If the value is not an entity, this will always return TRUE.

Parameters

mixed $value: The value to check.

string $property_path: The property path of the value.

Return value

bool TRUE if the value is not an entity, or the searching user has access to it; FALSE otherwise.

2 calls to SearchApiFieldTrait::checkEntityAccess()
SearchApiFieldTrait::extractProcessorProperty in src/Plugin/views/field/SearchApiFieldTrait.php
Extracts a processor-based property from an item.
SearchApiFieldTrait::extractPropertyValues in src/Plugin/views/field/SearchApiFieldTrait.php
Places extracted property values and objects into the result row.

File

src/Plugin/views/field/SearchApiFieldTrait.php, line 1062

Class

SearchApiFieldTrait
Provides a trait to use for Search API Views field handlers.

Namespace

Drupal\search_api\Plugin\views\field

Code

protected function checkEntityAccess($value, $property_path) {
  if (!$value instanceof EntityInterface) {
    return TRUE;
  }
  if (!empty($this->skipAccessChecks[$property_path])) {
    return TRUE;
  }
  if (!isset($this->accessAccount)) {
    $this->accessAccount = $this
      ->getQuery()
      ->getAccessAccount() ?: FALSE;
  }
  return $value
    ->access('view', $this->accessAccount ?: NULL);
}