Webform module and config export

This commit is contained in:
Rob Davies 2017-03-16 15:29:07 +00:00
parent 3e6a5cbed2
commit 0e15467384
1040 changed files with 117682 additions and 0 deletions

View file

@ -0,0 +1,35 @@
<?php
namespace Drupal\webform;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityAccessControlHandler;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
/**
* Defines the access control handler for the webform submission entity type.
*
* @see \Drupal\webform\Entity\WebformSubmission.
*/
class WebformSubmissionAccessControlHandler extends EntityAccessControlHandler {
/**
* {@inheritdoc}
*/
public function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
// Allow users with 'view any webform submission' to view all submissions.
if ($operation == 'view' && $account->hasPermission('view any webform submission')) {
return AccessResult::allowed();
}
/** @var \Drupal\webform\WebformSubmissionInterface $entity */
$webform = $entity->getWebform();
if ($webform->access('update') || $webform->checkAccessRules($operation, $account, $entity)) {
return AccessResult::allowed();
}
return parent::checkAccess($entity, $operation, $account);
}
}