You are here

function _book_access_node_access_records_roles in Book access 6

Gets the list of grant records assigned to user roles for a book.

Parameters

$grants: An array of grants.

$bid: The ID of the book for which the function returns the grant records.

2 calls to _book_access_node_access_records_roles()
book_access_node_access_records in ./book_access.module
Implements hook_node_access_records().
_book_access_build_node_grants in ./book_access.module
Rebuilds the book page grants for the node passed as argument.

File

./book_access.module, line 452
Allows access control for book nodes on a per book basis. It is based on forum_access.module and tac_lite.module.

Code

function _book_access_node_access_records_roles(&$grants, $bid) {
  $result = db_query('SELECT * FROM {book_access_role} WHERE nid = %d', $bid);
  while ($grant = db_fetch_object($result)) {
    $grants[] = array(
      'realm' => 'book_access_role',
      'gid' => $grant->rid,
      'grant_view' => $grant->grant_view,
      'grant_update' => $grant->grant_update,
      'grant_delete' => $grant->grant_delete,
      'priority' => BOOK_ACCESS_GRANT_PRIORITY,
    );
  }
}