You are here

function _services_raw_field_access in Services Client 7

Same name and namespace in other branches
  1. 7.2 services_raw/services_raw.inc \_services_raw_field_access()

Determine whether user has access to node resource and raw node_save.

Parameters

$op: Operation

$args: Additional arguments passed to call

1 string reference to '_services_raw_field_access'
_services_raw_services_resources in services_raw/services_raw.inc
Provides API definition of provided services objects and operations.

File

services_raw/services_raw.inc, line 262
Custom services definition and implementation of all callbacks.

Code

function _services_raw_field_access($op = 'view', $args = array()) {
  switch ($args['entity_type']) {
    case 'node':
      module_load_include('inc', 'services', 'resources/node_resource');
      $args[0]['nid'] = uuid_node_find($args['uuid']);
      return user_access('access raw node_save') && _node_resource_access($op, $args);
    case 'user':
      module_load_include('inc', 'services', 'resources/user_resource');
      $args[0]['uid'] = uuid_user_find($args['uuid']);
      return user_access('access raw user_save') && _node_resource_access($op, $args);

    // This could be expanded to allow for other entity types as this module
    // develops to support them. For now we can only dance with nodes and users.
    default:
      return FALSE;
  }
}