function _nodehierarchyaccess_set_descendant_grants in Node Hierarchy 6.3
Same name and namespace in other branches
- 5 nodehierarchyaccess/nodehierarchyaccess.module \_nodehierarchyaccess_set_descendant_grants()
- 6.2 nodehierarchyaccess/nodehierarchyaccess.module \_nodehierarchyaccess_set_descendant_grants()
Set the given grants for the children nodes
2 calls to _nodehierarchyaccess_set_descendant_grants()
- nodehierarchyaccess_nodeapi in nodehierarchyaccess/
nodehierarchyaccess.module - Implementation of hook_nodeapi().
- nodehierarchyaccess_page_form_submit in nodehierarchyaccess/
nodehierarchyaccess.module - Callback for the nodeaccess form submit
File
- nodehierarchyaccess/
nodehierarchyaccess.module, line 173 - A module to integrate nodehierarchy and nodeaccess.
Code
function _nodehierarchyaccess_set_descendant_grants($nid, $grants = NULL) {
if ($grants == NULL) {
$grants = _nodehierarchyaccess_get_node_grants($nid);
}
$descendants = _nodehierarchy_get_children_menu_links($nid);
// copy grants to the descendants of the node
foreach ($descendants as $descendant) {
$node = new stdClass();
$node->nid = $descendant['nid'];
_nodehierarchyaccess_update_node_access($node, $grants, TRUE);
if ($descendant['has_children']) {
_nodehierarchyaccess_set_descendant_grants($node->nid, $grants);
}
}
}