function _nodehierarchyaccess_copy_parent_grants in Node Hierarchy 5
Same name and namespace in other branches
- 6.3 nodehierarchyaccess/nodehierarchyaccess.module \_nodehierarchyaccess_copy_parent_grants()
- 6.2 nodehierarchyaccess/nodehierarchyaccess.module \_nodehierarchyaccess_copy_parent_grants()
Copy a node's parent's grants to the given node.
1 call to _nodehierarchyaccess_copy_parent_grants()
- nodehierarchyaccess_nodeapi in nodehierarchyaccess/
nodehierarchyaccess.module - Implementation of hook_nodeapi().
File
- nodehierarchyaccess/
nodehierarchyaccess.module, line 76 - A module to integrate nodehierarchy and nodeaccess.
Code
function _nodehierarchyaccess_copy_parent_grants($node) {
if (isset($node->parent) && $node->parent) {
// get the parent node grants and assign to the node.
$grants = _nodehierarchyaccess_get_node_grants($node->parent);
// save the node itself
node_access_write_grants($node, $grants);
_nodeaccess_save_new($node->nid, $grants);
// copy grants to the descendants of the node
_nodehierarchyaccess_set_descendant_grants($node->nid, $grants);
}
}