function node_access_test_node_access_records

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

Implements hook_node_access_records().

File

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

Code

function node_access_test_node_access_records($node) {
    $grants = array();
    // For NodeAccessBaseTableTestCase, only set records for private nodes.
    if (!variable_get('node_access_test_private') || $node->private) {
        $grants[] = array(
            'realm' => 'node_access_test',
            'gid' => 8888,
            'grant_view' => 1,
            'grant_update' => 0,
            'grant_delete' => 0,
            'priority' => 0,
        );
        $grants[] = array(
            'realm' => 'node_access_test',
            'gid' => 8889,
            'grant_view' => 1,
            'grant_update' => 0,
            'grant_delete' => 0,
            'priority' => 0,
        );
        // For the author realm, the GID is equivalent to a UID, which
        // means there are many many groups of just 1 user.
        $grants[] = array(
            'realm' => 'node_access_test_author',
            'gid' => $node->uid,
            'grant_view' => 1,
            'grant_update' => 1,
            'grant_delete' => 1,
            'priority' => 0,
        );
    }
    return $grants;
}

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