class WebformSourceEntityAccess in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Access/WebformSourceEntityAccess.php \Drupal\webform\Access\WebformSourceEntityAccess
Defines the custom access control handler for the webform source entities.
Hierarchy
- class \Drupal\webform\Access\WebformSourceEntityAccess
Expanded class hierarchy of WebformSourceEntityAccess
1 file declares its use of WebformSourceEntityAccess
- WebformSourceEntityAccessTest.php in tests/
src/ Unit/ Access/ WebformSourceEntityAccessTest.php
File
- src/
Access/ WebformSourceEntityAccess.php, line 12
Namespace
Drupal\webform\AccessView source
class WebformSourceEntityAccess {
/**
* Check whether the user can access an entity's webform results.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* An entity.
* @param \Drupal\Core\Session\AccountInterface $account
* Run access checks for this account.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*/
public static function checkEntityResultsAccess(EntityInterface $entity, AccountInterface $account) {
/** @var \Drupal\webform\WebformEntityReferenceManagerInterface $entity_reference_manager */
$entity_reference_manager = \Drupal::service('webform.entity_reference_manager');
$access = $entity
->access('update', $account, TRUE);
$access
->andIf(AccessResult::allowedIf($entity_reference_manager
->getWebform($entity)));
return $access;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WebformSourceEntityAccess:: |
public static | function | Check whether the user can access an entity's webform results. |