function wf_crm_autocomplete_access in Webform CiviCRM Integration 7.3
Access callback. Check if user has permission to view autocomplete results.
Parameters
$node: Node object
$fid: Webform component id
Return value
bool
1 call to wf_crm_autocomplete_access()
- wf_crm_ajax in ./contact_component.inc 
- Drupal page callback to serve AJAX requests.
File
- ./contact_component.inc, line 654 
Code
function wf_crm_autocomplete_access($node, $fid) {
  global $user;
  if (!$fid || empty($node->webform['components'][$fid]) || !node_access('view', $node)) {
    return FALSE;
  }
  if ($user->uid === 1 || webform_results_access($node)) {
    return TRUE;
  }
  if (!empty($node->webform['components'][$fid]['private'])) {
    return FALSE;
  }
  if (variable_get('webform_submission_access_control', 1)) {
    $allowed_roles = array();
    foreach ($node->webform['roles'] as $rid) {
      $allowed_roles[$rid] = isset($user->roles[$rid]) ? TRUE : FALSE;
    }
    if (array_search(TRUE, $allowed_roles) === FALSE) {
      return FALSE;
    }
  }
  return TRUE;
}