You are here

function acl_node_test_node_access_records in ACL 7

Same name and namespace in other branches
  1. 8 tests/modules/acl_node_test/acl_node_test.module \acl_node_test_node_access_records()

Implements hook_node_access_records().

Implicit View by All is allowed.

File

tests/acl_node_test.module, line 28
Dummy module implementing node related hooks to test API interaction with the Node module.

Code

function acl_node_test_node_access_records($node) {
  $grants = array();
  if ($node->type == 'article') {

    // Create grant in arbitrary article_realm for article nodes.
    $grants[] = array(
      'realm' => 'test_article_realm',
      'gid' => 1,
      'grant_view' => 1,
      'grant_update' => 0,
      'grant_delete' => 0,
      'priority' => 0,
    );
  }
  elseif ($node->type == 'page') {

    // Create grant in arbitrary page_realm for page nodes.
    $grants[] = array(
      'realm' => 'test_page_realm',
      'gid' => 1,
      'grant_view' => 1,
      'grant_update' => 0,
      'grant_delete' => 0,
      'priority' => 0,
    );
  }
  return $grants;
}