You are here

function hosting_platform_node_access in Hosting 7.3

Same name and namespace in other branches
  1. 7.4 platform/hosting_platform.module \hosting_platform_node_access()

Implements hook_node_access().

File

platform/hosting_platform.module, line 176
Platform node type definition.

Code

function hosting_platform_node_access($node, $op, $account) {
  if (hosting_feature('client') && $op != 'create') {

    // We rely on hosting_client_node_grants() instead of global configuration.
    return NODE_ACCESS_IGNORE;
  }
  $type = is_string($node) ? $node : $node->type;
  if ($type != 'platform') {
    return NODE_ACCESS_IGNORE;
  }
  switch ($op) {
    case 'create':
      return user_access('create platform', $account);
    case 'update':
      return user_access('edit platform', $account);
    case 'delete':
      return user_access('delete platform', $account);
    case 'view':
      return user_access('view platform', $account);
  }
}