You are here

function node_service_get_access in Services 6.2

Same name and namespace in other branches
  1. 6 services/node_service/node_service.inc \node_service_get_access()
  2. 7 services/node_service/node_service.inc \node_service_get_access()

Check if the user has the permission to get the node's data thru services.

Parameters

$nid: Number. The node ID.

Return value

Boolean. TRUE if the user has view access.

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

File

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

Code

function node_service_get_access($nid) {
  global $user;
  $node = node_load($nid);

  // If the node doesn't exist, we want to report a 'node not found' services
  // error, but if we return FALSE here services will report an 'access denied'
  // error. So we just return TRUE here and let everything move to fail in the
  // callback function.
  if (!$node) {
    return TRUE;
  }
  return node_access('view', $node) && user_access('load node data');
}