Skip to content

Commit

Permalink
Merge pull request #935 from jitendrapurohit/block-access
Browse files Browse the repository at this point in the history
Return access denied if user is blocked from accessing the webform
  • Loading branch information
KarinG authored Jan 8, 2024
2 parents 0844ed8 + 0598914 commit a76e094
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/WebformCivicrmPreProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\webform\Utility\WebformHtmlHelper;
use Drupal\webform\Utility\WebformXss;

use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;

class WebformCivicrmPreProcess extends WebformCivicrmBase implements WebformCivicrmPreProcessInterface {

Expand Down Expand Up @@ -162,8 +162,7 @@ public function alterForm() {
}
if ($this->settings['block_unknown_users']) {
$this->form['submitted']['#access'] = $this->form['actions']['#access'] = FALSE;
$this->setMessage(t('Sorry, you do not have permission to access this form.'), 'warning');
return;
throw new AccessDeniedHttpException();
}
}
if (!empty($this->data['participant_reg_type'])) {
Expand Down

0 comments on commit a76e094

Please sign in to comment.