| 5 node_access_example.module | node_access_example_node_grants($account, $op) |
| 6 node_access_example.module | node_access_example_node_grants($account, $op) |
| 7 node_access_example.module | node_access_example_node_grants($account, $op) |
| 8 node_access_example.module | 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.
File
- developer/
examples/ node_access_example.module, line 53 - This is an example illustrating how to restrict access to nodes based on some criterion associated with the user.
Code
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