You are here

class SolrAdminAccessCheck in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 modules/search_api_solr_admin/src/Access/SolrAdminAccessCheck.php \Drupal\search_api_solr_admin\Access\SolrAdminAccessCheck
  2. 8.2 modules/search_api_solr_admin/src/Access/SolrAdminAccessCheck.php \Drupal\search_api_solr_admin\Access\SolrAdminAccessCheck

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

Hierarchy

Expanded class hierarchy of SolrAdminAccessCheck

1 string reference to 'SolrAdminAccessCheck'
search_api_solr_admin.services.yml in modules/search_api_solr_admin/search_api_solr_admin.services.yml
modules/search_api_solr_admin/search_api_solr_admin.services.yml
1 service uses SolrAdminAccessCheck
access_check.search_api_solr_admin in modules/search_api_solr_admin/search_api_solr_admin.services.yml
Drupal\search_api_solr_admin\Access\SolrAdminAccessCheck

File

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

Namespace

Drupal\search_api_solr_admin\Access
View source
class SolrAdminAccessCheck implements AccessInterface {

  /**
   * A custom access check.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   Run access checks for this account.
   * @param \Drupal\search_api\ServerInterface|null $search_api_server
   *   (optional) The Search API server entity.
   */
  public function access(AccountInterface $account, ServerInterface $search_api_server = NULL) {
    if ($search_api_server) {
      $backend = $search_api_server
        ->getBackend();
      if ($backend instanceof SolrBackendInterface) {
        if (!$backend
          ->getSolrConnector()
          ->isCloud()) {
          return AccessResult::allowed();
        }
      }
    }
    return AccessResult::forbidden();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SolrAdminAccessCheck::access public function A custom access check.