You are here

function _nodehierarchyaccess_copy_parent_grants in Node Hierarchy 6.3

Same name and namespace in other branches
  1. 5 nodehierarchyaccess/nodehierarchyaccess.module \_nodehierarchyaccess_copy_parent_grants()
  2. 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_page_form_submit in nodehierarchyaccess/nodehierarchyaccess.module
Callback for the nodeaccess form submit

File

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

Code

function _nodehierarchyaccess_copy_parent_grants($nid, $grants = NULL) {
  if ($grants == NULL) {
    $new_parent_nid = _nodehierarchyaccess_get_parent_nid($nid);
    $grants = _nodehierarchyaccess_get_node_grants($new_parent_nid);
  }
  $node = new stdClass();
  $node->nid = $nid;
  _nodehierarchyaccess_update_node_access($node, $grants, TRUE);
}