You are here

function apachesolr_nodeaccess_apachesolr_modify_query in Apache Solr Search 5

Same name and namespace in other branches
  1. 5.2 contrib/apachesolr_nodeaccess/apachesolr_nodeaccess.module \apachesolr_nodeaccess_apachesolr_modify_query()
  2. 6 contrib/apachesolr_nodeaccess/apachesolr_nodeaccess.module \apachesolr_nodeaccess_apachesolr_modify_query()
  3. 6.2 contrib/apachesolr_nodeaccess/apachesolr_nodeaccess.module \apachesolr_nodeaccess_apachesolr_modify_query()

Implementation of hook_apachesolr_modify_query().

File

contrib/apachesolr_nodeaccess/apachesolr_nodeaccess.module, line 55

Code

function apachesolr_nodeaccess_apachesolr_modify_query(&$query, &$params) {
  global $user;
  try {
    $subquery = _apachesolr_nodeaccess_build_subquery($user);
  } catch (Exception $e) {
    $query = NULL;
    watchdog("apachesolr_nodeaccess", 'User %name (UID:!uid) is not allowed to access any content', array(
      '%name' => $user->name,
      '!uid' => $user->uid,
    ));
    return;
  }
  if (!empty($subquery)) {
    $query
      ->add_subquery($subquery, 'AND');
  }
}