You are here

restws_test.module in RESTful Web Services 7.2

Same filename and directory in other branches
  1. 7 tests/restws_test.module

RESTful web services test module.

File

tests/restws_test.module
View source
<?php

/**
 * @file
 * RESTful web services test module.
 */

/**
 * Implements hook_restws_resource_info_alter().
 *
 * @see RestWSTestCase::testMenuPath().
 */
function restws_test_restws_resource_info_alter(&$resource_info) {
  $menu_path = variable_get('restws_test_menu_path', 'foo');
  $resource_info['node']['menu_path'] = $menu_path;
}

/**
 * Implements hook_field_access().
 *
 * @see RestWSTestCase::testFieldAccess()
 */
function restws_test_field_access($op, $field, $entity_type, $entity, $account) {
  if ($field['field_name'] == 'field_text' && $op == 'edit') {

    // Only allow edit access for a higher level permission.
    return user_access('administer users', $account);
  }
  return TRUE;
}