You are here

function _nodehierarchyaccess_set_descendant_grants in Node Hierarchy 5

Same name and namespace in other branches
  1. 6.3 nodehierarchyaccess/nodehierarchyaccess.module \_nodehierarchyaccess_set_descendant_grants()
  2. 6.2 nodehierarchyaccess/nodehierarchyaccess.module \_nodehierarchyaccess_set_descendant_grants()

Set the given grants for the given node and it's descentants

2 calls to _nodehierarchyaccess_set_descendant_grants()
nodehierarchyaccess_page_form_submit in nodehierarchyaccess/nodehierarchyaccess.module
Callback for the nodeaccess form submit
_nodehierarchyaccess_copy_parent_grants in nodehierarchyaccess/nodehierarchyaccess.module
Copy a node's parent's grants to the given node.

File

nodehierarchyaccess/nodehierarchyaccess.module, line 91
A module to integrate nodehierarchy and nodeaccess.

Code

function _nodehierarchyaccess_set_descendant_grants($nid, $grants) {

  // copy grants to the descendants of the node
  foreach (nodehierarchy_get_descendant_list($nid) as $descendant_nid) {
    $node = new stdClass();
    $node->nid = $descendant_nid;
    node_access_write_grants($node, $grants);
    _nodeaccess_save_new($descendant_nid, $grants);
  }
}