You are here

public function Item::checkAccess in Search API 8

Checks whether a user has permission to view this item.

Parameters

\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 ItemInterface::checkAccess

Deprecated

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

See also

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

File

src/Item/Item.php, line 428

Class

Item
Provides a default implementation for a search item.

Namespace

Drupal\search_api\Item

Code

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