You are here

protected function WebformSubmissionStorage::hasAnonymousSubmissionTracking in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/WebformSubmissionStorage.php \Drupal\webform\WebformSubmissionStorage::hasAnonymousSubmissionTracking()

Check if anonymous users submission are tracked using $_SESSION.

Parameters

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

Return value

bool TRUE if anonymous users submission are tracked using $_SESSION.

1 call to WebformSubmissionStorage::hasAnonymousSubmissionTracking()
WebformSubmissionStorage::setAnonymousSubmission in src/WebformSubmissionStorage.php
Track anonymous submissions.

File

src/WebformSubmissionStorage.php, line 1616

Class

WebformSubmissionStorage
Defines the webform submission storage.

Namespace

Drupal\webform

Code

protected function hasAnonymousSubmissionTracking(WebformSubmissionInterface $webform_submission) {
  $webform = $webform_submission
    ->getWebform();
  if ($this->currentUser
    ->hasPermission('view own webform submission')) {
    return TRUE;
  }
  elseif ($this->accessRulesManager
    ->checkWebformSubmissionAccess('view_own', $this->currentUser, $webform_submission)
    ->isAllowed()) {
    return TRUE;
  }
  elseif ($webform
    ->getSetting('limit_user') || $webform
    ->getSetting('entity_limit_user') && $webform_submission
    ->getSourceEntity()) {
    return TRUE;
  }
  elseif ($webform
    ->getSetting('form_convert_anonymous')) {
    return TRUE;
  }
  elseif ($webform
    ->getSetting('draft') === WebformInterface::DRAFT_ALL) {
    return TRUE;
  }
  elseif ($webform
    ->hasAnonymousSubmissionTrackingHandler()) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}