You are here

function node_service_save_access in Services 6.2

Same name and namespace in other branches
  1. 5 services/node_service/node_service.module \node_service_save_access()
  2. 6 services/node_service/node_service.inc \node_service_save_access()
  3. 7 services/node_service/node_service.inc \node_service_save_access()

Check if the user has the permission to save a node.

Parameters

$node: Object. The node object.

Return value

Boolean. TRUE if the user has the permission to save a node.

1 string reference to 'node_service_save_access'
node_service_service in services/node_service/node_service.module
Implementation of hook_service().

File

services/node_service/node_service.inc, line 206
Link general node functionalities to services module.

Code

function node_service_save_access($node) {
  $node = (array) $node;
  if (isset($node['nid']) && !empty($node['nid'])) {

    // Grab the existing node information and use that for the access check.
    $old_node = node_load($node['nid']);
    return node_access('update', $old_node);
  }
  return node_access('create', $node['type']);
}