Restricting view of nodes on taxonomy aggregation pages? I have a taxonomy vocabulary that I use in many different content types.  I want to restrict, programmatically, access rights to specific content types.  As in, a specific role is not able to view particular content types unless they directly authored the item.  This includes any view of a particular node (full, teaser, etc.).  I've implemented hook_node_access as follows:

function progress_reporting_node_access($node, $op, $account) {
  if ($account-&gt;uid == 0) {
    return NODE_ACCESS_IGNORE;
  }
  if (_is_tagged($node,$account) &amp;&amp; $op == 'update') {
    return NODE_ACCESS_ALLOW;
  }

  $records = _non_viewable_records();
  if (is_object($node) &amp;&amp; in_array($node-&gt;type,$records)) {
    if ($op == 'view' &amp;&amp; $node-&gt;uid != $account-&gt;uid) {
      drupal_set_message('Sorry, you cannot access this page. &lt;a href="/"&gt;Click here to get back home&lt;/a&gt;.','error');
      return NODE_ACCESS_DENY;
    }
  }

  return NODE_ACCESS_IGNORE;
}


The only thing that I didn't realize is that this affects a user only when they try to view the full node.  So, when a user navigates to a taxonomy term's aggregation page, all the teasers of all the content that the term is referenced in shows up, regardless of the logic I applied in hook_node_access.

I need to somehow apply the same restrictions to all node views.  In other words, when they navigate to the taxonomy term aggregation page, they don't see teasers that they're not supposed to see.

How can this be done, programmatically, exactly?
You're looking for hook_node_access_records:

http://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/hook_node_access_records/7