You are here

function background_process_service_access in Background Process 7.2

Same name and namespace in other branches
  1. 8 background_process.module \background_process_service_access()
  2. 6 background_process.module \background_process_service_access()
  3. 7 background_process.module \background_process_service_access()

Access handler for service call

1 string reference to 'background_process_service_access'
background_process_menu in ./background_process.module
Implements hook_menu().

File

./background_process.module, line 495

Code

function background_process_service_access($pid) {

  // Ensure no session!
  drupal_save_session(FALSE);
  unset($_SESSION);
  $process = BackgroundProcess::load($pid);
  if (!$process) {
    watchdog('bg_process', 'Unknown process: %pid', array(
      '%pid' => $pid,
    ));
    return FALSE;
  }
  $token = $_POST['token'];
  if ($token !== $process
    ->getToken()) {
    watchdog('bg_process', 'Invalid token: %token for handle: %handle', array(
      '%token' => $token,
      '%handle' => $process
        ->getHandle(),
    ));
    return FALSE;
  }
  return TRUE;
}