Paging issue in views when implements node access I have created a content type called Details it is the collection of employees detail. And also I have created a Taxonomy terms called manager, employee, lead. Also I have created a field(as Taxonomy reference) for user profile to indicate whether she/he is manager or lead or employee. Now I want to put the restriction based on the user. I have achieve the restriction using my custom module. The codes are below:

    function my_module_node_access($node, $op, $account) {
  global $user;
  $user_obj = user_load($account-&gt;uid);
  if (isset($node-&gt;type) &amp;&amp; ($node-&gt;type == 'details') &amp;&amp; ($op == 'view')) {
        if (($user-&gt;uid == 0) || ($user_obj-&gt;field_user_company['und'][0]['tid'] != $node-&gt;field_company['und'][0]['tid'])){
            return NODE_ACCESS_DENY;
        }       
    }  
  return NODE_ACCESS_IGNORE;
}


The above code simply do, if the node taxonomy term, and the user field taxonomy term is same then he will perfectly access to the nodes. I got struggle with views. I have created a view to show the node title that can be access by the user. Manager has 100 nodes to view, in views settings I have enable the pager, 25 items per page to display. Pager splits into 4 page and shows correctly. But when comes to employee user he has access to 1 node only, but in views it still shows the pager in 4 parts.

function my_module_views_post_execute(&amp;$view) {
  if (($view-&gt;name == 'views1') || ($view-&gt;name == 'views2')) {
        $nids = array();
      foreach($view-&gt;result as $key=&gt;$result) {
          $nids[$key] = $result-&gt;nid;
      }
      $nodes = node_load_multiple($nids);
      foreach ($nodes as $node) {
            if (!node_access('view',$node)) {
                $key = array_search($node-&gt;nid, $nids);

                unset($view-&gt;result[$key]);
            }
        }
     }
  }


The views pager display must be changed dynamically depends on the number of nodes. Is anyone knows kindly show me a right path to achieve this???
hook_node_access() doesn't really do any access checks on node listings or views.

To get this to work you should look into implementing hook_node_grants() and hook_node_access_records()

That logic will be included in your views query so you could get rid of hook_views_post_execute()