node_access_example_node_grants

Versions
4.6 – 7
node_access_example_node_grants($account, $op)

Implementation of hook_node_grants().

Since we are restricting access based on a permission, we need to check that permission and return the appropriate result.

Code

developer/examples/node_access_example.module, line 53

<?php
function node_access_example_node_grants($account, $op) {
  $grants = array();
  if (user_access('access content', $account)) {
    $grants[] = 0;
  }
  if (user_access('access private content', $account)) {
    $grants[] = 1;
  }
  return array('example' => $grants);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.