You are here

public function SolrAdminAccessCheck::access in Search API Solr 8.3

Same name and namespace in other branches
  1. 8.2 modules/search_api_solr_admin/src/Access/SolrAdminAccessCheck.php \Drupal\search_api_solr_admin\Access\SolrAdminAccessCheck::access()
  2. 4.x modules/search_api_solr_admin/src/Access/SolrAdminAccessCheck.php \Drupal\search_api_solr_admin\Access\SolrAdminAccessCheck::access()

A custom access check.

Parameters

\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.

\Drupal\search_api\ServerInterface|null $search_api_server: (optional) The Search API server entity.

File

modules/search_api_solr_admin/src/Access/SolrAdminAccessCheck.php, line 24

Class

SolrAdminAccessCheck
Provides an access check for the "Solr Admin" routes.

Namespace

Drupal\search_api_solr_admin\Access

Code

public function access(AccountInterface $account, ServerInterface $search_api_server = NULL) {
  if ($search_api_server && $search_api_server
    ->getBackend() instanceof SolrBackendInterface) {
    return AccessResult::allowed();
  }
  return AccessResult::forbidden();
}