You are here

function taxonomy_access_nodeapi in Taxonomy Access Control 6

Same name and namespace in other branches
  1. 5.2 taxonomy_access.module \taxonomy_access_nodeapi()
  2. 5 taxonomy_access.module \taxonomy_access_nodeapi()

Implements hook_nodeapi().

File

./taxonomy_access.module, line 369
Allows administrators to specify how each category (in the taxonomy) can be used by various roles.

Code

function taxonomy_access_nodeapi(&$node, $op, $arg = 0) {
  switch ($op) {
    case 'presave':
      break;
    case 'update':

      // restore terms that the user shouldn't have access to delete
      taxonomy_access_restore_terms($node->nid, $node->vid, $node->tac_protected_terms);
      break;
    case 'delete':

      // Remove our entries for this node from table {node_access}.

      //INFO: node_access_write_grants($node, $grants, $realm = NULL, $delete = TRUE)
      node_access_write_grants($node, array(), 'term_access');
      break;
  }
}