node_access by specific role? I am trying to build a list of node ids that have view access for a specific role. Is this at all possible? I currently have an array of all 'page' content type nodes "pages".

I now need to loop through these and see if they have a specific role enabled, if so get the id and display the link on a page if the user has access to that page.

I know I can do that using the following example. But this just checks if the user has view access, and the user could have access from another role they have which my list would not be accurate for what I am trying to achieve.

if(node_access('view', $nodeid, $user)){
    // do something
}


Or is there a way to check if a specific users role has view access rather than just access in general. 

The reason I am trying to do this, is I am trying to get the list of specific pages dynamically if a role is given to that node "page". 

Sorry if my terminology is off I am not super familiar with drupal.
This is what I ended up using, it could probably be optimized a bit but it works.

&lt;?php
if ($node = menu_get_object()) {
  // Get the nid
  $currentNode = $node-&gt;nid;
}
if (in_array("Gold Member", $user-&gt;roles)) {
    echo '&lt;div id="title"&gt;&lt;h1 class="title display"&gt;Free Courses for Gold Members&lt;/h1&gt;&lt;/div&gt;';

    echo '&lt;ul class="course_page_ul"&gt;';
        $role_type = 'Gold Member';// Texas Member
        $getRole = db_query("SELECT rid FROM role WHERE name = '%s'",$role_type);
        while ($roleid = db_fetch_object ($getRole)) {
          $roleids[] = $roleid;
        }   
        //Get the ID of the role type we are using from the array
        foreach($roleids as $roleId){
            $role_id = $roleId-&gt;rid;
        }

        $node_type = "page";
        $result = db_query("SELECT * FROM node WHERE type = '%s'", $node_type);
        $nids = array();
        while ($obj = db_fetch_object ($result)) {
          $nids[] = $obj;
        }

        $idsToInclude = array();
        foreach ($nids as $pageId) {
            $page_id = $pageId-&gt;nid;
            $realm = 'content_access_rid';// content access
            $grant_view = 1; // Has view
            $result = db_query("SELECT * FROM node_access WHERE nid != '%d' and nid = '%d' and gid = '%d' and realm = '%s' and grant_view = '%d'",$currentNode, $page_id, $role_id, $realm, $grant_view);

            while ($obj = db_fetch_object ($result)) {
              $idsToInclude[] = $obj;
            }           
        }

        //var_dump($user-&gt;uid);
        //var_dump($nids);

        foreach($idsToInclude as $id){
            $courses = $id-&gt;nid;
            $nodeid = node_load($courses );
            if(node_access('view', $nodeid, $user)){ 
                echo '&lt;li class="course_link"&gt;&lt;a href="/node/'.$courses .'" title=""&gt;'.$nodeid-&gt;title.'&lt;/a&gt;&lt;/li&gt;'; 
            }
        } 
    echo '&lt;/ul&gt;';
}

?&gt;