You are here

public function WebformSubmission::isOwner in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Entity/WebformSubmission.php \Drupal\webform\Entity\WebformSubmission::isOwner()

Test whether the provided account is owner of this webform submission.

Parameters

\Drupal\Core\Session\AccountInterface $account: Account whose ownership to test.

Return value

bool Whether the provided account is owner of this webform submission.

Overrides WebformSubmissionInterface::isOwner

File

src/Entity/WebformSubmission.php, line 679

Class

WebformSubmission
Defines the WebformSubmission entity.

Namespace

Drupal\webform\Entity

Code

public function isOwner(AccountInterface $account) {
  if ($account
    ->isAnonymous()) {
    return !empty($_SESSION['webform_submissions']) && isset($_SESSION['webform_submissions'][$this
      ->id()]);
  }
  else {
    return $account
      ->id() === $this
      ->getOwnerId();
  }
}