You are here

public static function WebformNodeAccess::checkWebformResultsAccess in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_node/src/Access/WebformNodeAccess.php \Drupal\webform_node\Access\WebformNodeAccess::checkWebformResultsAccess()

Check whether the user can access a node's webform results.

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.

2 calls to WebformNodeAccess::checkWebformResultsAccess()
WebformNodeAccess::checkWebformLogAccess in modules/webform_node/src/Access/WebformNodeAccess.php
Check whether the user can access a node's webform log.
WebformOptionsLimitAccess::checkNodeAccess in modules/webform_options_limit/src/Access/WebformOptionsLimitAccess.php
Check whether the user can access a node's webform options limits summary.
2 string references to 'WebformNodeAccess::checkWebformResultsAccess'
webform_node.routing.yml in modules/webform_node/webform_node.routing.yml
modules/webform_node/webform_node.routing.yml
webform_submission_export_import.routing.yml in modules/webform_submission_export_import/webform_submission_export_import.routing.yml
modules/webform_submission_export_import/webform_submission_export_import.routing.yml

File

modules/webform_node/src/Access/WebformNodeAccess.php, line 60

Class

WebformNodeAccess
Defines the custom access control handler for the webform node.

Namespace

Drupal\webform_node\Access

Code

public static function checkWebformResultsAccess($operation, $entity_access, NodeInterface $node, AccountInterface $account) {
  $access_result = static::checkAccess($operation, $entity_access, $node, NULL, $account);
  if ($access_result
    ->isAllowed()) {

    /** @var \Drupal\webform\WebformEntityReferenceManagerInterface $entity_reference_manager */
    $entity_reference_manager = \Drupal::service('webform.entity_reference_manager');
    $webform = $entity_reference_manager
      ->getWebform($node);
    return WebformEntityAccess::checkResultsAccess($webform, $node);
  }
  else {
    return $access_result;
  }
}