You are here

public function WebformAccessRulesManager::checkWebformAccess in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformAccessRulesManager.php \Drupal\webform\WebformAccessRulesManager::checkWebformAccess()

Check if operation is allowed through access rules for a given webform.

Parameters

string $operation: Operation to check.

\Drupal\Core\Session\AccountInterface $account: Account who is requesting the operation.

\Drupal\webform\WebformInterface $webform: Webform on which the operation is requested.

Return value

\Drupal\Core\Access\AccessResultInterface Access result.

Overrides WebformAccessRulesManagerInterface::checkWebformAccess

File

src/WebformAccessRulesManager.php, line 38

Class

WebformAccessRulesManager
The webform access rules manager service.

Namespace

Drupal\webform

Code

public function checkWebformAccess($operation, AccountInterface $account, WebformInterface $webform) {
  $access_rules = $this
    ->getAccessRules($webform);
  $cache_per_user = $this
    ->cachePerUser($access_rules);
  $condition = $this
    ->checkAccessRules($operation, $account, $access_rules);
  return WebformAccessResult::allowedIf($condition, $webform, $cache_per_user);
}