You are here

function _book_access_build_node_grants in Book access 6

Same name and namespace in other branches
  1. 5 book_access.module \_book_access_build_node_grants()

Rebuilds the book page grants for the node passed as argument.

Parameters

$node: The node for which the grants needs to be rebuilt.

2 calls to _book_access_build_node_grants()
book_access_edit_form_submit in ./book_access.module
Form submission callback for node_form(), and book_outline_form().
book_access_outline_form_submit in ./book_access.module
Form submission callback for book_outline_form().

File

./book_access.module, line 394
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_build_node_grants($node) {
  if (!empty($node->nid) && !empty($node->book['bid'])) {
    $grants = array();
    _book_access_node_access_records_roles($grants, $node->book['bid']);
    node_access_write_grants($node, $grants, 'book_access_role');
    $grants = array();
    _book_access_node_access_records_users($grants, $node->book['bid']);
    node_access_write_grants($node, $grants, 'book_access_user');
  }
}