You are here

workbench_moderation_node_access_test.module in Workbench Moderation 7.3

Test module for node access control on moderated nodes.

File

tests/workbench_moderation_node_access_test/workbench_moderation_node_access_test.module
View source
<?php

/**
 * @file
 * Test module for node access control on moderated nodes.
 */

/**
 * Implements hook_node_grants().
 */
function workbench_moderation_node_access_test_node_grants($account, $op) {

  // Give everyone full grants so we don't break other node tests.
  return array(
    'test_wm_realm' => array(
      1,
    ),
  );
}

/**
 * Implements hook_node_access_records().
 */
function workbench_moderation_node_access_test_node_access_records($node) {

  // Return nothing for unpublished nodes.
  if (!$node->status) {
    return array();
  }
  $grants[] = array(
    'realm' => 'test_wm_realm',
    'gid' => 1,
    'grant_view' => 1,
    'grant_update' => 0,
    'grant_delete' => 0,
    'priority' => 0,
  );
  return $grants;
}