You are here

public static function WebformEmailReplyForm::checkReplyAccess in Webform Email Reply 8

Check that webform submission resend access check.

Parameters

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

\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

1 string reference to 'WebformEmailReplyForm::checkReplyAccess'
webform_email_reply.routing.yml in ./webform_email_reply.routing.yml
webform_email_reply.routing.yml

File

src/Form/WebformEmailReplyForm.php, line 90
Contains \Drupal\webform_email_reply\Form\WebformEmailReplyForm.

Class

WebformEmailReplyForm

Namespace

Drupal\webform_email_reply\Form

Code

public static function checkReplyAccess(WebformSubmissionInterface $webform_submission, AccountInterface $account) {
  if ($webform_submission
    ->getWebform()
    ->hasMessageHandler()) {
    if ($account
      ->hasPermission('send email replies to all webforms') || $account
      ->hasPermission('send email replies to own webforms')) {
      return AccessResult::allowed();
    }
  }
  return AccessResult::forbidden();
}