function node_access_test_node_grants

Same name in other branches
  1. 9 core/modules/node/tests/modules/node_access_test/node_access_test.module \node_access_test_node_grants()
  2. 8.9.x core/modules/node/tests/modules/node_access_test/node_access_test.module \node_access_test_node_grants()
  3. 10 core/modules/node/tests/modules/node_access_test/node_access_test.module \node_access_test_node_grants()

Implements hook_node_grants().

File

modules/node/tests/node_access_test.module, line 15

Code

function node_access_test_node_grants($account, $op) {
    $grants = array();
    // First grant a grant to the author for own content.
    $grants['node_access_test_author'] = array(
        $account->uid,
    );
    if ($op == 'view' && user_access('node test view', $account)) {
        $grants['node_access_test'] = array(
            8888,
            8889,
        );
    }
    if ($op == 'view' && $account->uid == variable_get('node_test_node_access_all_uid', 0)) {
        $grants['node_access_all'] = array(
            0,
        );
    }
    return $grants;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.