2 * Implements hook_node_grants_alter().
4 function {{ machine_name }}_node_grants_alter(&$grants, $account, $op) {
5 // Our sample module never allows certain roles to edit or delete
6 // content. Since some other node access modules might allow this
7 // permission, we expressly remove it by returning an empty $grants
8 // array for roles specified in our variable setting.
10 // Get our list of banned roles.
11 $restricted = variable_get('example_restricted_roles', array());
13 if ($op != 'view' && !empty($restricted)) {
14 // Now check the roles for this account against the restrictions.
15 foreach ($restricted as $role_id) {
16 if (isset($account->roles[$role_id])) {