You are here

public function DatasourcePluginBase::checkItemAccess in Search API 8

Checks whether a user has permission to view the given item.

Parameters

\Drupal\Core\TypedData\ComplexDataInterface $item: An item of this datasource's type.

\Drupal\Core\Session\AccountInterface|null $account: (optional) The user session for which to check access, or NULL to check access for the current user.

Return value

bool TRUE if access is granted, FALSE otherwise.

Overrides DatasourceInterface::checkItemAccess

Deprecated

in search_api:8.x-1.14 and is removed from search_api:2.0.0. Use getItemAccessResult() instead.

See also

https://www.drupal.org/node/3051902

File

src/Datasource/DatasourcePluginBase.php, line 101

Class

DatasourcePluginBase
Defines a base class from which other datasources may extend.

Namespace

Drupal\search_api\Datasource

Code

public function checkItemAccess(ComplexDataInterface $item, AccountInterface $account = NULL) {
  @trigger_error('\\Drupal\\search_api\\Datasource\\DatasourceInterface::checkItemAccess() is deprecated in search_api:8.x-1.14 and is removed from search_api:2.0.0. Use getItemAccessResult() instead. See https://www.drupal.org/node/3051902', E_USER_DEPRECATED);
  return $this
    ->getItemAccessResult($item, $account)
    ->isAllowed();
}