You are here

function search_api_solr_access_server_files in Search API Solr 7

Access callback for a server's "Files" tab.

Grants access if the user has the "administer search_api" permission and the server is a Solr server.

Parameters

SearchApiServer $server: The server for which access should be tested.

Return value

bool TRUE if access should be granted, FALSE otherwise.

1 call to search_api_solr_access_server_files()
search_api_access_server_files in ./search_api_solr.module
1 string reference to 'search_api_solr_access_server_files'
search_api_solr_menu in ./search_api_solr.module
Implements hook_menu().

File

./search_api_solr.module, line 325
Provides a Solr-based service class for the Search API.

Code

function search_api_solr_access_server_files(SearchApiServer $server) {
  if (!user_access('administer search_api')) {
    return FALSE;
  }
  $service_info = search_api_get_service_info($server->class);
  $service_class = $service_info['class'];
  if (empty($service_class) || !class_exists($service_class)) {

    // Service class not found.
    return FALSE;
  }
  if ($service_class == 'SearchApiSolrService' || in_array('SearchApiSolrService', class_parents($service_class))) {

    // It's an SearchApiSolrService based connection class.
    return TRUE;
  }
  return FALSE;
}