public static function WebformNodeAccess::checkWebformLogAccess in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_node/src/Access/WebformNodeAccess.php \Drupal\webform_node\Access\WebformNodeAccess::checkWebformLogAccess()
Check whether the user can access a node's webform log.
Parameters
string $operation: Operation being performed.
string $entity_access: Entity access rule that needs to be checked.
\Drupal\node\NodeInterface $node: A node.
\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
1 string reference to 'WebformNodeAccess::checkWebformLogAccess'
- webform_submission_log.routing.yml in modules/
webform_submission_log/ webform_submission_log.routing.yml - modules/webform_submission_log/webform_submission_log.routing.yml
File
- modules/
webform_node/ src/ Access/ WebformNodeAccess.php, line 88
Class
- WebformNodeAccess
- Defines the custom access control handler for the webform node.
Namespace
Drupal\webform_node\AccessCode
public static function checkWebformLogAccess($operation, $entity_access, NodeInterface $node, AccountInterface $account) {
$access_result = static::checkWebformResultsAccess($operation, $entity_access, $node, $account);
if (!$access_result
->isAllowed()) {
return $access_result;
}
/** @var \Drupal\webform\WebformEntityReferenceManagerInterface $entity_reference_manager */
$entity_reference_manager = \Drupal::service('webform.entity_reference_manager');
$webform = $entity_reference_manager
->getWebform($node);
if (!$webform
->hasSubmissionLog()) {
$access_result = AccessResult::forbidden();
}
return $access_result
->addCacheableDependency($webform)
->addCacheTags([
'config:webform.settings',
]);
}